Created
May 24, 2014 00:12
-
-
Save kurogelee/cf45d82736cf27438273 to your computer and use it in GitHub Desktop.
Clojureのvectorに対するlastは遅い ref: http://qiita.com/kurogelee/items/019d3be32ea34bfb22e1
This file contains hidden or 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
Elapsed time: 0.007123 msecs | |
Elapsed time: 0.005308 msecs | |
Elapsed time: 0.003352 msecs | |
Elapsed time: 191.406869 msecs | |
Elapsed time: 129.120391 msecs | |
Elapsed time: 77.368283 msecs | |
Elapsed time: 243.091859 msecs | |
Elapsed time: 0.006216 msecs | |
Elapsed time: 29.659985 msecs | |
Elapsed time: 0.093308 msecs | |
Elapsed time: 0.006775 msecs |
This file contains hidden or 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
(def s (doall (range 2000000))) | |
(def v (vec s)) | |
(def l (apply list s)) | |
(time (first s)) | |
(time (first v)) | |
(time (first l)) | |
(time (last s)) | |
(time (last v)) | |
(time (last l)) | |
(time (nth s (dec (count s)))) | |
(time (nth v (dec (count v)))) | |
(time (nth l (dec (count l)))) | |
(time (get v (dec (count v)))) | |
(time (peek v)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment