@@ -24,7 +24,6 @@ const { compare } = process.binding('buffer');
2424const util = require ( 'util' ) ;
2525const { isSet, isMap } = process . binding ( 'util' ) ;
2626const { objectToString } = require ( 'internal/util' ) ;
27- const { Buffer } = require ( 'buffer' ) ;
2827const errors = require ( 'internal/errors' ) ;
2928
3029// The assert module provides functions that throw
@@ -119,6 +118,7 @@ function areSimilarRegExps(a, b) {
119118// barrier including the Buffer.from operation takes the advantage of the faster
120119// compare otherwise. 300 was the number after which compare became faster.
121120function areSimilarTypedArrays ( a , b ) {
121+ const { from } = require ( 'buffer' ) . Buffer ;
122122 const len = a . byteLength ;
123123 if ( len !== b . byteLength ) {
124124 return false ;
@@ -131,12 +131,8 @@ function areSimilarTypedArrays(a, b) {
131131 }
132132 return true ;
133133 }
134- return compare ( Buffer . from ( a . buffer ,
135- a . byteOffset ,
136- len ) ,
137- Buffer . from ( b . buffer ,
138- b . byteOffset ,
139- b . byteLength ) ) === 0 ;
134+ return compare ( from ( a . buffer , a . byteOffset , len ) ,
135+ from ( b . buffer , b . byteOffset , b . byteLength ) ) === 0 ;
140136}
141137
142138function isFloatTypedArrayTag ( tag ) {
0 commit comments