Skip to content

Commit cd7d371

Browse files
targosjasnell
authored andcommitted
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: #8754 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Ilkka Myller <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Johan Bergström <[email protected]>
1 parent a3388c4 commit cd7d371

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/buffer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ const { isArrayBuffer, isSharedArrayBuffer } = process.binding('util');
66
const bindingObj = {};
77
const internalUtil = require('internal/util');
88

9-
class FastBuffer extends Uint8Array {}
9+
class FastBuffer extends Uint8Array {
10+
constructor(arg1, arg2, arg3) {
11+
super(arg1, arg2, arg3);
12+
}
13+
}
1014

1115
FastBuffer.prototype.constructor = Buffer;
1216
Buffer.prototype = FastBuffer.prototype;

0 commit comments

Comments
 (0)