Browse Source

buffer: fix performance regression

V8 5.4 changed the way that the default constructor of derived classes
is called. It introduced a significant performance regression in the
buffer module for the creation of pooled buffers. This commit forces the
definition back to how it was implicitly before.

Ref: https://bugs.chromium.org/p/v8/issues/detail?id=4890

PR-URL: https://github.com/nodejs/node/pull/8754
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
v6.x
Michaël Zasso 8 years ago
committed by Jeremiah Senkpiel
parent
commit
b9c2270502
  1. 6
      lib/buffer.js

6
lib/buffer.js

@ -6,7 +6,11 @@ const { isArrayBuffer, isSharedArrayBuffer } = process.binding('util');
const bindingObj = {};
const internalUtil = require('internal/util');
class FastBuffer extends Uint8Array {}
class FastBuffer extends Uint8Array {
constructor(arg1, arg2, arg3) {
super(arg1, arg2, arg3);
}
}
FastBuffer.prototype.constructor = Buffer;
Buffer.prototype = FastBuffer.prototype;

Loading…
Cancel
Save