codemix/fast.js — pull request #11 by phpnode (2014-06-24 22:55:00+00:00)
Title: Iterate function context

Manual merge of #3 to add benchmarks, here's the relevant results:

```

> fast.js@0.0.0 bench /projects/codemix/2014/fastjs
> node ./bench/index.js

Running 9 benchmarks, please wait...

Native .map() vs fast.map() (3 items)
✓ Array::map() x 2,313,874 ops/sec ±2.33% (76 runs sampled)
✓ fast.map() x 17,094,799 ops/sec ±1.77% (89 runs sampled)
✓ fast.map() v0.0.0 x 13,792,510 ops/sec ±1.78% (82 runs sampled)

Winner is: fast.map() (638.80% faster)

Native .map() vs fast.map() (10 items)
✓ Array::map() x 1,486,769 ops/sec ±2.34% (77 runs sampled)
✓ fast.map() x 7,862,070 ops/sec ±1.77% (90 runs sampled)
✓ fast.map() v0.0.0 x 5,466,531 ops/sec ±1.61% (92 runs sampled)

Winner is: fast.map() (428.80% faster)

Native .map() vs fast.map() (1000 items)
✓ Array::map() x 31,118 ops/sec ±1.57% (87 runs sampled)
✓ fast.map() x 99,263 ops/sec ±1.39% (93 runs sampled)
✓ fast.map() v0.0.0 x 64,210 ops/sec ±1.14% (84 runs sampled)

Winner is: fast.map() (218.99% faster)

Native .reduce() vs fast.reduce() (3 items)
✓ Array::reduce() x 6,293,313 ops/sec ±1.27% (90 runs sampled)
✓ fast.reduce() x 19,157,053 ops/sec ±1.65% (80 runs sampled)
✓ fast.reduce() v0.0.0 x 15,004,798 ops/sec ±1.47% (90 runs sampled)

Winner is: fast.reduce() (204.40% faster)

Native .reduce() vs fast.reduce() (10 items)
✓ Array::reduce() x 2,706,296 ops/sec ±1.75% (85 runs sampled)
✓ fast.reduce() x 8,825,375 ops/sec ±1.75% (89 runs sampled)
✓ fast.reduce() v0.0.0 x 5,473,944 ops/sec ±1.55% (91 runs sampled)

Winner is: fast.reduce() (226.11% faster)

Native .reduce() vs fast.reduce() (1000 items)
✓ Array::reduce() x 33,989 ops/sec ±1.62% (92 runs sampled)
✓ fast.reduce() x 114,030 ops/sec ±2.63% (90 runs sampled)
✓ fast.reduce() v0.0.0 x 67,511 ops/sec ±1.89% (87 runs sampled)

Winner is: fast.reduce() (235.49% faster)

Native .forEach() vs fast.forEach() (3 items)
✓ Array::forEach() x 6,251,905 ops/sec ±1.46% (90 runs sampled)
✓ fast.forEach() x 18,521,280 ops/sec ±2.26% (85 runs sampled)
✓ fast.forEach() v0.0.0 x 14,778,325 ops/sec ±1.83% (91 runs sampled)

Winner is: fast.forEach() (196.25% faster)

Native .forEach() vs fast.forEach() (10 items)
✓ Array::forEach() x 2,716,677 ops/sec ±1.81% (90 runs sampled)
✓ fast.forEach() x 8,007,081 ops/sec ±1.64% (93 runs sampled)
✓ fast.forEach() v0.0.0 x 5,579,772 ops/sec ±1.80% (85 runs sampled)

Winner is: fast.forEach() (194.74% faster)

Native .forEach() vs fast.forEach() (1000 items)
✓ Array::forEach() x 33,615 ops/sec ±1.67% (91 runs sampled)
✓ fast.forEach() x 98,508 ops/sec ±1.59% (93 runs sampled)
✓ fast.forEach() v0.0.0 x 63,139 ops/sec ±1.69% (89 runs sampled)

Winner is: fast.forEach() (193.04% faster)

Finished in 300 seconds
```

fixes #3. Many thanks @megawac