mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
19 lines
445 B
JavaScript
19 lines
445 B
JavaScript
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()
|