fez/fez — pull request #42 by miketheprogrammer (2014-02-20 19:26:34+00:00)
Title: Feature perf fast set

This request improves the Set implementation. Exchanges memory for speed;

As you can see the new set is faster in all cases except for #array which involves a conversion
from object to array. Its speed is essentially O(n);

We lose some compatibility with i.e. 6,7,8 however since this is not a public module and just internal, it doesn't seem like a big deal.

Set1#insert x 3,666 ops/sec ±37.85% (10 runs sampled)
Set2#insert x 2,876,527 ops/sec ±41.20% (30 runs sampled)
Fastest is Set2#insert

Set1#remove x 13,848 ops/sec ±43.38% (8 runs sampled)
Set2#remove x 9,022,816 ops/sec ±5.00% (73 runs sampled)
Fastest is Set2#remove

Set1#exists x 11,839 ops/sec ±3.47% (50 runs sampled)
Set2#exists x 13,934,046 ops/sec ±3.44% (82 runs sampled)
Fastest is Set2#exists

Set1#array-10k elements x 59,200,551 ops/sec ±2.53% (86 runs sampled)
Set2#array-10k elements x 1,027 ops/sec ±0.97% (93 runs sampled)
Fastest is Set1#array-10k elements

npm test

> fez@1.0.6 test /fez
> runtests

basic.js ........................................................................... 4/4 ✓
c.js ............................................................................... 4/4 ✓
less.js ............................................................................ 5/5 ✓

Totals: 3 PASSED 0 FAILED (100%)