David Contreras 367c0d3d1e
chore: improve performance of functions map, filter and forEach (#3256)
* Implement reduceCallback

* Add jsdocs

* implement simplifyCallback in other functions

* Moved recurse to array.js

* Format

* Separate transform callback

* forEach transform

* Renamed applyCallback to simplifyCallback

* Simplified index transform

* renamed to reducedCallback and simplifiedCallback to simpleCallback

* chore: fix linting issue

* Added forEach benchmark

* renamed simplifyCallback to optimizeCallback

---------

Co-authored-by: Jos de Jong <wjosdejong@gmail.com>
2024-09-11 11:32:17 +02:00
..

Benchmarks

This directory contains benchmarks which can be used when working on performance improvements of math.js.

How to run

First build the source code once:

$ npm install
$ npm run build

To run all benchmarks:

$ node index.js

To run a single set of benchmarks:

$ node expression_parser.js

Python benchmarks

Install python, and the python library numpy, then run the benchmarks:

$ python matrix_operations_python.py

Octave benchmarks

For matrix operations, there is a small benchmark for Octave. Open Octave, run the script matrix_operations_octave.m

To do

  • use larger matrix, like 250x250 instead of 25x25
  • Compare expression parsers
    • math.js
    • expr-eval
    • jsep
    • math-expression-evaluator