From bce35cd58d337d316a6b2a369fd58465e88ffaf2 Mon Sep 17 00:00:00 2001 From: Matthieu Monsch <1216372+mtth@users.noreply.github.com> Date: Sat, 30 Mar 2024 09:59:28 -0700 Subject: [PATCH] Update slow buffer creation calls (#456) --- lib/types.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/types.js b/lib/types.js index a650afae..eae7868f 100644 --- a/lib/types.js +++ b/lib/types.js @@ -13,11 +13,7 @@ */ let utils = require('./utils'), - platform = require('./platform'), - buffer = require('buffer'); // For `SlowBuffer`. - -let Buffer = buffer.Buffer; -let SlowBuffer = buffer.SlowBuffer; + platform = require('./platform'); // Convenience imports. let Tap = utils.Tap; @@ -32,7 +28,7 @@ let TYPES; let RANDOM = new utils.Lcg(); // Encoding tap (shared for performance). -let TAP = new Tap(new SlowBuffer(1024)); +let TAP = new Tap(Buffer.allocUnsafeSlow(1024)); // Currently active logical type, used for name redirection. let LOGICAL_TYPE = null; @@ -443,7 +439,7 @@ class Type { static __reset (size) { debug('resetting type buffer to %d', size); - TAP.buf = new SlowBuffer(size); + TAP.buf = Buffer.allocUnsafeSlow(size); } get branchName () {