mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
util: improve performance of function areSimilarFloatArrays
Improve performance of areSimilarFloatArrays by using primordial. Refs: https://github.com/nodejs/node/pull/50621 PR-URL: https://github.com/nodejs/node/pull/51040 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
9f88f40cae
commit
c3b89c310f
1 file changed
+3
-1
@@ -21,6 +21,7 @@ const {
|
||||
StringPrototypeValueOf,
|
||||
SymbolPrototypeValueOf,
|
||||
TypedArrayPrototypeGetSymbolToStringTag,
|
||||
TypedArrayPrototypeGetByteLength,
|
||||
Uint8Array,
|
||||
} = primordials;
|
||||
|
||||
@@ -71,7 +72,8 @@ function areSimilarFloatArrays(a, b) {
|
||||
if (a.byteLength !== b.byteLength) {
|
||||
return false;
|
||||
}
|
||||
for (let offset = 0; offset < a.byteLength; offset++) {
|
||||
const len = TypedArrayPrototypeGetByteLength(a);
|
||||
for (let offset = 0; offset < len; offset++) {
|
||||
if (a[offset] !== b[offset]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user