From e8a70bd5e1f203d75a2bc31db178a6a322bbefbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 24 Sep 2016 00:46:03 +0200 Subject: [PATCH] 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. Ref: https://bugs.chromium.org/p/v8/issues/detail?id=4890 --- lib/buffer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/buffer.js b/lib/buffer.js index 876bdbe1cfde61..86aa2e512ea352 100644 --- a/lib/buffer.js +++ b/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;