Created
February 13, 2017 19:53
-
-
Save semaperepelitsa/79576063f449621f9a452ae3edb0529a to your computer and use it in GitHub Desktop.
simple-benchmark clojurescript example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Compare vector vs list: | |
cljs.user=> (simple-benchmark [nums (into (vector) (range 9999))] (nth nums 5000) 1000) | |
[nums (into (vector) (range 9999))], (nth nums 5000), 1000 runs, 2 msecs | |
nil | |
cljs.user=> (simple-benchmark [nums (into (list) (range 9999))] (nth nums 5000) 1000) | |
[nums (into (list) (range 9999))], (nth nums 5000), 1000 runs, 240 msecs | |
nil | |
; It looks similar to let: | |
cljs.user=> (let [nums (into (vector) (range 9999))] (nth nums 5000)) | |
4998 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment