Skip to content

Commit

Permalink
Merge pull request Kitware#2427 from FezVrasta/patch-1
Browse files Browse the repository at this point in the history
perf: faster createArray function
  • Loading branch information
floryst authored May 20, 2022
2 parents 64fac4e + ba64b19 commit ac7e6f6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Sources/Common/Core/Math/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ function vtkSwapVectors3(v1, v2) {
}

function createArray(size = 3) {
const array = [];
while (array.length < size) {
array.push(0);
}
return array;
// faster than Array.from and/or while loop
return Array(size).fill(0);
}

// ----------------------------------------------------------------------------
Expand Down

0 comments on commit ac7e6f6

Please sign in to comment.