mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
chore: add a benchmark testing DenseMatrix.map(...) and DenseMatrix.forEach(...) (see #3251)
This commit is contained in:
parent
84effa73fc
commit
88a4b35e9d
@ -6,3 +6,4 @@ import './matrix_operations.js'
|
||||
import './prime.js'
|
||||
import './load.js'
|
||||
import './scope_variables.js'
|
||||
import './map.js'
|
||||
|
||||
18
test/benchmark/map.js
Normal file
18
test/benchmark/map.js
Normal file
@ -0,0 +1,18 @@
|
||||
import Benchmark from 'benchmark'
|
||||
import { ones } from '../../lib/esm/index.js'
|
||||
|
||||
const denseMatrix = ones(100, 100, 'dense')
|
||||
|
||||
new Benchmark.Suite()
|
||||
.add('DenseMatrix.map(...)', () => {
|
||||
denseMatrix.map(value => value)
|
||||
})
|
||||
.add('DenseMatrix.forEach(...)', () => {
|
||||
denseMatrix.forEach(() => { /* noop */ })
|
||||
})
|
||||
.on('cycle', function (event) {
|
||||
console.log(String(event.target))
|
||||
})
|
||||
.on('complete', function () {
|
||||
})
|
||||
.run()
|
||||
Loading…
x
Reference in New Issue
Block a user