Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance issues with deepMap #3266

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
Added tests for callbacks with three arguments.
  • Loading branch information
dvd101x committed Sep 20, 2024
commit 9f80b901e6cb12e49279748d356ea65d77b3586b
12 changes: 12 additions & 0 deletions test/benchmark/forEach.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ new Benchmark.Suite()
.add(pad('forEach(genericMatrix, abs+idx)'), () => {
forEach(genericMatrix, (x, idx) => abs(x) + idx[0] - idx[1])
})
.add(pad('genericMatrix.forEach(abs+idx+arr)'), () => {
genericMatrix.forEach((x, idx, X) => abs(x) + idx[0] - idx[1] + X.get([0, 0]))
})
.add(pad('numberMatrix.forEach(abs+idx+arr)'), () => {
numberMatrix.forEach((x, idx, X) => abs(x) + idx[0] - idx[1] + X.get([0, 0]))
})
.add(pad('forEach(genericMatrix, abs+idx+arr)'), () => {
forEach(genericMatrix, (x, idx, X) => abs(x) + idx[0] - idx[1] + X.get([0, 0]))
})
.add(pad('forEach(array, abs+idx+arr)'), () => {
forEach(array, (x, idx, X) => abs(x) + idx[0] - idx[1] + X[0][0])
})
.add()
.on('cycle', function (event) {
console.log(String(event.target))
Expand Down
9 changes: 9 additions & 0 deletions test/benchmark/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ new Benchmark.Suite()
.add(pad('numberMatrix.map(abs + idx)'), () => {
numberMatrix.map((x, idx) => abs(x) + idx[0] - idx[1])
})
.add(pad('map(array, abs + idx + arr)'), () => {
map(array, (x, idx, X) => abs(x) + idx[0] - idx[1] + X[0][0])
})
.add(pad('genericMatrix.map(abs + idx + matrix)'), () => {
genericMatrix.map((x, idx, X) => abs(x) + idx[0] - idx[1] + X.get([0, 0]))
})
.add(pad('numberMatrix.map(abs + idx + matrix)'), () => {
numberMatrix.map((x, idx, X) => abs(x) + idx[0] - idx[1] + X.get([0, 0]))
})
.on('cycle', function (event) {
console.log(String(event.target))
})
Expand Down