Skip to content

Instantly share code, notes, and snippets.

@wrobstory
Last active August 29, 2015 14:09
Show Gist options
  • Save wrobstory/398706fd4a4c3c663448 to your computer and use it in GitHub Desktop.
Save wrobstory/398706fd4a4c3c663448 to your computer and use it in GitHub Desktop.
Cardinality
;; Cardinality 10-10000, seq of 100000 integers
(def card10 (gen/sample (gen/choose 0 10) 100000))
(def card100 (gen/sample (gen/choose 0 100) 100000))
(def card1000 (gen/sample (gen/choose 0 1000) 100000))
(def card10000 (gen/sample (gen/choose 0 10000) 100000))
;; Create levels and an integer array representing those levels
user=> (time (dotimes [n 5] (def myarr (ca/make-indexed-array card10))))
"Elapsed time: 1841.995 msecs"
nil
user=> (time (dotimes [n 5] (def myarr (ca/make-indexed-array card100))))
"Elapsed time: 2246.822 msecs"
nil
user=> (time (dotimes [n 5] (def myarr (ca/make-indexed-array card1000))))
"Elapsed time: 7051.138 msecs"
nil
user=> (time (dotimes [n 5] (def myarr (ca/make-indexed-array card10000))))
"Elapsed time: 59649.677 msecs"
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment