Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dvd101x committed Dec 16, 2024
1 parent 3a44e32 commit f98a164
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
17 changes: 7 additions & 10 deletions test/benchmark/forEach.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ const genericMatrix = map(ones(10, 10, 'dense'), _ => round(random(-5, 5), 2))
const numberMatrix = new DenseMatrix(genericMatrix, 'number')
const array = genericMatrix.toArray()

// console.log('data', array)
// console.log('abs(data)', abs(array))npm run

const bench = new Bench({ time: 100, iterations: 100 })
.add('abs(genericMatrix)', () => {
abs(genericMatrix)
Expand Down Expand Up @@ -43,25 +40,25 @@ const bench = new Bench({ time: 100, iterations: 100 })
.add('numberMatrix.forEach(abs.signatures.number)', () => {
numberMatrix.forEach(abs.signatures.number)
})
.add(pad('genericMatrix.forEach(abs+idx)'), () => {
.add('genericMatrix.forEach(abs+idx)', () => {
genericMatrix.forEach((x, idx) => abs(x) + idx[0] - idx[1])
})
.add(pad('numberMatrix.forEach(abs+idx)'), () => {
.add('numberMatrix.forEach(abs+idx)', () => {
numberMatrix.forEach((x, idx) => abs(x) + idx[0] - idx[1])
})
.add(pad('forEach(genericMatrix, abs+idx)'), () => {
.add('forEach(genericMatrix, abs+idx)', () => {
forEach(genericMatrix, (x, idx) => abs(x) + idx[0] - idx[1])
})
.add(pad('genericMatrix.forEach(abs+idx+arr)'), () => {
.add('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)'), () => {
.add('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)'), () => {
.add('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)'), () => {
.add('forEach(array, abs+idx+arr)', () => {
forEach(array, (x, idx, X) => abs(x) + idx[0] - idx[1] + X[0][0])
})
.add()
Expand Down
15 changes: 6 additions & 9 deletions test/benchmark/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ const genericMatrix = map(ones(10, 10, 'dense'), _ => round(random(-5, 5), 2))
const numberMatrix = new DenseMatrix(genericMatrix, 'number')
const array = genericMatrix.toArray()

// console.log('data', array)
// console.log('abs(data)', abs(array))npm run

const bench = new Bench({ time: 100, iterations: 100 })
.add('abs(genericMatrix)', () => {
abs(genericMatrix)
Expand Down Expand Up @@ -43,22 +40,22 @@ const bench = new Bench({ time: 100, iterations: 100 })
.add('numberMatrix.map(abs.signatures.number)', () => {
numberMatrix.map(abs.signatures.number)
})
.add(pad('map(array, abs + idx)'), () => {
.add('map(array, abs + idx)', () => {
map(array, (x, idx) => abs(x) + idx[0] - idx[1])
})
.add(pad('genericMatrix.map(abs + idx)'), () => {
.add('genericMatrix.map(abs + idx)', () => {
genericMatrix.map((x, idx) => abs(x) + idx[0] - idx[1])
})
.add(pad('numberMatrix.map(abs + idx)'), () => {
.add('numberMatrix.map(abs + idx)', () => {
numberMatrix.map((x, idx) => abs(x) + idx[0] - idx[1])
})
.add(pad('map(array, abs + idx + arr)'), () => {
.add('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)'), () => {
.add('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)'), () => {
.add('numberMatrix.map(abs + idx + matrix)', () => {
numberMatrix.map((x, idx, X) => abs(x) + idx[0] - idx[1] + X.get([0, 0]))
})
.on('cycle', function (event) {
Expand Down

0 comments on commit f98a164

Please sign in to comment.