Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve perf of io/file-attributes using CLJS Bean #969

Closed
mfikes opened this issue Jun 11, 2019 · 1 comment · Fixed by #971
Closed

Improve perf of io/file-attributes using CLJS Bean #969

mfikes opened this issue Jun 11, 2019 · 1 comment · Fixed by #971
Assignees

Comments

@mfikes
Copy link
Member

mfikes commented Jun 11, 2019

The CLJS Bean library provides a faster alternative to js->clj, and this can be used in io/file-attributes for a substantial speedup:

Before:

cljs.user=> (require '[planck.io :as io] '[planck.core :refer [file-seq]])
nil
cljs.user=> (let [files (doall (file-seq "/Users/mfikes/Documents"))]
       #_=>  (time (transduce (comp (map io/file-attributes) (map :reference-count)) + files)))
"Elapsed time: 31.728287 msecs"
1432

After:

cljs.user=> (require '[planck.io :as io] '[planck.core :refer [file-seq]])
nil
cljs.user=> (let [files (doall (file-seq "/Users/mfikes/Documents"))]
       #_=>  (time (transduce (comp (map io/file-attributes) (map :reference-count)) + files)))
"Elapsed time: 13.202166 msecs"
1432
@pyrmont
Copy link
Contributor

pyrmont commented Jun 11, 2019

Wow, that's pretty dramatic. Looks like a spiffy little library :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants