Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cd891b3

Browse filesBrowse files
Septa2112RafaelGSS
authored andcommitted
util: improve performance of function areSimilarFloatArrays
Improve performance of areSimilarFloatArrays by using primordial. Refs: #50621 PR-URL: #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>
1 parent 048349e commit cd891b3
Copy full SHA for cd891b3

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Open diff view settings
Collapse file

‎lib/internal/util/comparisons.js‎

Copy file name to clipboardExpand all lines: lib/internal/util/comparisons.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const {
2121
StringPrototypeValueOf,
2222
SymbolPrototypeValueOf,
2323
TypedArrayPrototypeGetSymbolToStringTag,
24+
TypedArrayPrototypeGetByteLength,
2425
Uint8Array,
2526
} = primordials;
2627

@@ -71,7 +72,8 @@ function areSimilarFloatArrays(a, b) {
7172
if (a.byteLength !== b.byteLength) {
7273
return false;
7374
}
74-
for (let offset = 0; offset < a.byteLength; offset++) {
75+
const len = TypedArrayPrototypeGetByteLength(a);
76+
for (let offset = 0; offset < len; offset++) {
7577
if (a[offset] !== b[offset]) {
7678
return false;
7779
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.