]> zoso.dev Git - buffer.git/commit
Speed up buffer creation.
authorMatthieu Monsch <monsch@alum.mit.edu>
Fri, 8 Jan 2016 05:28:12 +0000 (21:28 -0800)
committerMatthieu Monsch <monsch@alum.mit.edu>
Fri, 8 Jan 2016 18:05:30 +0000 (10:05 -0800)
commit12a3318ecbdf3f5155741f662dcf4376683cda61
treed7fd07d777e1003eebc28cc02d6184ac74984010
parentada621b6a1c08ea79e30dfe0a9594511b08e6b64
Speed up buffer creation.

Since 1d20f50f8b4c62779c0dbfb1fa401168ab52dce0 (#40), instances already
gained all the `Buffer`'s methods via the prototype re-assignment.
Skipping the `_augment` call yields significant speedups:

~50% faster small buffer creation:

  new(16) before: 595,757 ops/sec ±0.92% (91 runs sampled)
  new(16) after: 894,462 ops/sec ±0.69% (87 runs sampled)

~20% faster slice:

  slice before: 2,176,194 ops/sec ±1.59% (89 runs sampled)
  slice after: 2,624,209 ops/sec ±0.42% (99 runs sampled)

Other benchmarks aren't significantly different.
index.js