stathat/consistent — pull request #1 by zeebo (2012-07-13 01:38:18+00:00)
Title: Optimizations

So I saw your announcement and thought it was a neat project and decided to see if I could make it run faster.

I added a bunch of benchmarks for allocations and speed of some of the operations and did a quick first pass removing the easy hot spots, like using a buffer for the hash instead of allocating every time, and using string concatenation and the strconv package instead of fmt. That gave some nice speedups with minimal code changed. Then I did a huge rewrite on the guts of the thing so that it wouldn't have to recreate and resort the stuff every time something was added or removed. That gave some much better speedups in the case of a large set of items in the hash. It did increase code complexity, so I'd understand if you wanted to keep it simple and reject those changes.

Thanks.