Details
Description
As discussed with mmarczyk in irc, the attached patch implements Clojure's hash-set function and modifies the compiler to create sets using a new fromArray static method. To test these, I created three new benchmarks. Here's before and after benchmark results:
$ time ./script/benchmark | grep '#{'
[], #{}, 100000 runs, 77 msecs
[], #{1 2 3}, 100000 runs, 582 msecs
[coll #{1 2 3}], (conj coll 4), 100000 runs, 104 msecs
[], #{}, 100000 runs, 740 msecs
[], #{1 2 3}, 100000 runs, 1809 msecs
[coll #{1 2 3}], (conj coll 4), 100000 runs, 221 msecs
[], #{}, 100000 runs, 281 msecs
[], #{1 2 3}, 100000 runs, 1310 msecs
[coll #{1 2 3}], (conj coll 4), 100000 runs, 288 msecs
./script/benchmark 109.41s user 3.82s system 127% cpu 1:28.96 total
$ time ./script/benchmark | grep '#{'
[], #{}, 100000 runs, 1 msecs
[], #{1 2 3}, 100000 runs, 333 msecs
[coll #{1 2 3}], (conj coll 4), 100000 runs, 100 msecs
[], #{}, 100000 runs, 1 msecs
[], #{1 2 3}, 100000 runs, 1670 msecs
[coll #{1 2 3}], (conj coll 4), 100000 runs, 325 msecs
[], #{}, 100000 runs, 1 msecs
[], #{1 2 3}, 100000 runs, 689 msecs
[coll #{1 2 3}], (conj coll 4), 100000 runs, 321 msecs
./script/benchmark 103.94s user 4.89s system 108% cpu 1:39.88 total
grep '#{' 0.00s user 0.00s system 0% cpu 1:39.85 total
Attachments
Activity
| Field | Original Value | New Value |
|---|---|---|
| Attachment | making-sets.patch [ 11345 ] |
| Attachment | making-sets.patch [ 11343 ] |
| Attachment | making-sets-squashed.patch [ 11346 ] |
| Description |
As discussed with mmarczyk in irc, the attached patch implements Clojure's hash-set function and modifies the compiler to create sets using a new fromArray static method. To test these, I created three new benchmarks. Here's before and after benchmark results:
$ time ./script/benchmark | grep '#{' [], #{}, 100000 runs, 77 msecs [], #{1 2 3}, 100000 runs, 582 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 104 msecs [], #{}, 100000 runs, 740 msecs [], #{1 2 3}, 100000 runs, 1809 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 221 msecs [], #{}, 100000 runs, 281 msecs [], #{1 2 3}, 100000 runs, 1310 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 288 msecs ./script/benchmark 109.41s user 3.82s system 127% cpu 1:28.96 total $ time ./script/benchmark | grep '#{' [], #{}, 100000 runs, 37 msecs [], #{1 2 3}, 100000 runs, 314 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 103 msecs [], #{}, 100000 runs, 253 msecs [], #{1 2 3}, 100000 runs, 797 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 214 msecs [], #{}, 100000 runs, 168 msecs [], #{1 2 3}, 100000 runs, 790 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 211 msecs ./script/benchmark 112.00s user 4.29s system 130% cpu 1:29.36 total grep '#{' 0.00s user 0.00s system 0% cpu 1:29.36 total |
As discussed with mmarczyk in irc, the attached patch implements Clojure's hash-set function and modifies the compiler to create sets using a new fromArray static method. To test these, I created three new benchmarks. Here's before and after benchmark results:
$ time ./script/benchmark | grep '#{' [], #{}, 100000 runs, 77 msecs [], #{1 2 3}, 100000 runs, 582 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 104 msecs [], #{}, 100000 runs, 740 msecs [], #{1 2 3}, 100000 runs, 1809 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 221 msecs [], #{}, 100000 runs, 281 msecs [], #{1 2 3}, 100000 runs, 1310 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 288 msecs ./script/benchmark 109.41s user 3.82s system 127% cpu 1:28.96 total $ time ./script/benchmark | grep '#{' [], #{}, 100000 runs, 1 msecs [], #{1 2 3}, 100000 runs, 333 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 100 msecs [], #{}, 100000 runs, 1 msecs [], #{1 2 3}, 100000 runs, 1670 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 325 msecs [], #{}, 100000 runs, 1 msecs [], #{1 2 3}, 100000 runs, 689 msecs [coll #{1 2 3}], (conj coll 4), 100000 runs, 321 msecs ./script/benchmark 103.94s user 4.89s system 108% cpu 1:39.88 total grep '#{' 0.00s user 0.00s system 0% cpu 1:39.85 total |
| Resolution | Completed [ 1 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
Slightly better patch with the EMPTY case