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

Faster processing of collection literals #482

Closed
borkdude opened this issue Dec 20, 2020 · 3 comments
Closed

Faster processing of collection literals #482

borkdude opened this issue Dec 20, 2020 · 3 comments

Comments

@borkdude
Copy link
Collaborator

borkdude commented Dec 20, 2020

If we get {:a (+ 1 2 x)} maybe it would be faster to emit a function (fn [ctx] (hash-map :a (eval ctx '(+ 1 2 x)))) than another map from the analyzer?

This in turn can be unrolled like the other calls.

@borkdude
Copy link
Collaborator Author

borkdude commented Jan 21, 2021

First experiment in faster-maps branch (tests fail) using return-call:

$ tmp/master "(time (dotimes [i 1000000] {:i i :j i}))"
"Elapsed time: 1661.457229 msecs"
$ ./sci "(time (dotimes [i 1000000] {:i i :j i}))"
"Elapsed time: 796.002494 msecs"

@borkdude
Copy link
Collaborator Author

borkdude commented Jan 22, 2021

$ ./sci "(time (dotimes [i 1000000] [i (+ 1 2 i)]))"
"Elapsed time: 681.592362 msecs"
$ tmp/master "(time (dotimes [i 1000000] [i (+ 1 2 i)]))"
"Elapsed time: 1426.597451 msecs"

@borkdude
Copy link
Collaborator Author

borkdude commented Jan 23, 2021

./bb '(time (dotimes [i 1000000] ^{:a 1} [i (+ 1 2 3 i)]))'
"Elapsed time: 751.102041 msecs"
/usr/local/bin/bb '(time (dotimes [i 1000000] ^{:a 1} [i (+ 1 2 3 i)]))'
"Elapsed time: 1552.392127 msecs"
/usr/local/bin/bb '(time (dotimes [i 1000000] ^{:a i} [i (+ 1 2 3 i)]))'
"Elapsed time: 2508.376464 msecs"
./bb '(time (dotimes [i 1000000] ^{:a i} [i (+ 1 2 3 i)]))'
"Elapsed time: 836.875561 msecs"

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

No branches or pull requests

1 participant