nickb1080/poser-collection — pull request #34 by phpnode (2014-10-01 22:24:43+00:00)
Title: Add preliminary benchmarks

Hello, this looks pretty cool!

This adds some initial benchmarks mostly ripped from fast.js, I also made a couple of changes in this PR:

- `collection.js` is now `index.js` and is specified as main in `package.json`. This makes it easier to require and is more of a commonjs standard.

- `isArrayish()` is pretty slow compared to `Array.isArray()`, so I added a test for the presence and behavior of `Array.isArray()` so the code will use that method where possible.

### Benchmark Results
(run them yourself with `npm run bench`).
```
Running 6 benchmarks, please wait...

Array::map() vs Collection::map() - 3 items, preallocated
✓ Array::map() x 1,947,617 ops/sec ±1.95% (82 runs sampled)
✓ Collection.map() x 5,057,429 ops/sec ±1.77% (94 runs sampled)

Result: poser-collection is 159.67% faster than Array::map().

Array::map() vs Collection::map() - 10 items, preallocated
✓ Array::map() x 1,146,939 ops/sec ±1.88% (82 runs sampled)
✓ Collection.map() x 2,649,748 ops/sec ±1.84% (87 runs sampled)

Result: poser-collection is 131.03% faster than Array::map().

Array::map() vs Collection::map() - 1000 items, preallocated
✓ Array::map() x 20,190 ops/sec ±1.73% (90 runs sampled)
✓ Collection.map() x 39,633 ops/sec ±1.45% (87 runs sampled)

Result: poser-collection is 96.30% faster than Array::map().

Array::map() vs Collection::map() - 3 items
✓ Array::map() x 1,914,575 ops/sec ±1.76% (82 runs sampled)
✓ Collection.map() x 4,130,386 ops/sec ±1.39% (83 runs sampled)

Result: poser-collection is 115.73% faster than Array::map().

Array::map() vs Collection::map() - 10 items
✓ Array::map() x 1,099,576 ops/sec ±1.55% (82 runs sampled)
✓ Collection.map() x 2,154,972 ops/sec ±1.88% (92 runs sampled)

Result: poser-collection is 95.98% faster than Array::map().

Array::map() vs Collection::map() - 1000 items
✓ Array::map() x 13,923 ops/sec ±1.29% (85 runs sampled)
✓ Collection.map() x 7,695 ops/sec ±1.64% (91 runs sampled)

Result: poser-collection is 44.73% slower than Array::map().

Finished in 133 seconds

```

(invalidates #33)