codemix/fast.js — pull request #61 by phpnode (2014-09-28 22:53:34+00:00)
Title: Add fast.assign()

Adds `fast.assign()`, similar to [Object.assign()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) but with simpler (faster) error handling semantics.

> Note: node doesn't ship with Object.assign() support yet, I've included a shim which *does* follow the spec more closely for comparison, so this is not necessarily "Native vs fast.js" *yet*. SpiderMonkey nightly does support it though.

**V8 Benchmarks (shim)**

```
Object.assign() vs fast.assign()
✓ Object.assign() (shim!) x 250,955 ops/sec ±1.50% (89 runs sampled)
✓ fast.assign() x 588,789 ops/sec ±1.15% (100 runs sampled)
✓ lodash.assign() x 566,876 ops/sec ±1.34% (91 runs sampled)

Result: fast.js is 134.62% faster than Object.assign() (shim!).

Object.assign() vs fast.assign() (3 arguments)
✓ Object.assign() (shim!) x 203,651 ops/sec ±1.79% (81 runs sampled)
✓ fast.assign() x 599,373 ops/sec ±1.48% (96 runs sampled)

Result: fast.js is 194.31% faster than Object.assign() (shim!).

Object.assign() vs fast.assign() (10 arguments)
✓ Object.assign() (shim!) x 57,028 ops/sec ±1.45% (82 runs sampled)
✓ fast.assign() x 113,032 ops/sec ±1.36% (86 runs sampled)

Result: fast.js is 98.20% faster than Object.assign() (shim!).
```

**SpiderMonkey Benchmarks (native)**

```
Object.assign() vs fast.assign()
✓ Object.assign() x 234,311 ops/sec ±1.17% (67 runs sampled)
✓ fast.assign() x 833,371 ops/sec ±0.23% (61 runs sampled)
✓ lodash.assign() x 811,105 ops/sec ±0.18% (69 runs sampled)

Result: fast.js is 255.67% faster than Object.assign().

Object.assign() vs fast.assign() (3 arguments)
✓ Object.assign() x 183,274 ops/sec ±1.37% (67 runs sampled)
✓ fast.assign() x 636,999 ops/sec ±0.17% (69 runs sampled)

Result: fast.js is 247.57% faster than Object.assign().

Object.assign() vs fast.assign() (10 arguments)
✓ Object.assign() x 56,136 ops/sec ±1.00% (68 runs sampled)
✓ fast.assign() x 191,524 ops/sec ±0.25% (69 runs sampled)

Result: fast.js is 241.18% faster than Object.assign().

```