[CLJS-326] hash-set and PersistentHashSet/fromArray == faster set construction Created: 24/Jun/12 Updated: 25/Jun/12 Resolved: 25/Jun/12 |
|
| Status: | Resolved |
| Project: | ClojureScript |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Brandon Bloom | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | patch, patch, | ||
| Attachments: |
|
| Patch: | Code and Test |
| 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 '#{' $ time ./script/benchmark | grep '#{' |
| Comments |
| Comment by Brandon Bloom [ 24/Jun/12 8:47 PM ] |
|
Slightly better patch with the EMPTY case |
| Comment by David Nolen [ 24/Jun/12 10:13 PM ] |
|
Getting a weird error when I try to run the tests. Also can we squash the commits? Thanks! |
| Comment by Brandon Bloom [ 24/Jun/12 10:24 PM ] |
|
Squashed patch. |
| Comment by Brandon Bloom [ 24/Jun/12 10:28 PM ] |
|
Squashed and rebased on latest master. Is the rule no-multi-commit patches? Or simply just not for such small patches? In this case, I made and tested each each change in sequence. I also wanted the benchmarks to have a different sha1, so that the perf improvement would show up in the graphs. I'll try to provide squashed patches in the future. What weird error are you getting? Works for me :-P |
| Comment by Brandon Bloom [ 24/Jun/12 10:33 PM ] |
|
Updating 2nd benchmark in description to include the EMPTY optimization |
| Comment by David Nolen [ 25/Jun/12 6:33 AM ] |
|
fixed, http://github.com/clojure/clojurescript/commit/c60df78e2fd318109a9338a87277c11565b506ae |