mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
* Add unit parser benchmark * Add LRU to memoize function * Memoize _findUnit This fixes some performance issues in my heavily-unit-parsing app. Another idea might be to do an index of reversed unit names, and search in that, but this is much easier to implement and still should provide an improvement in the majority of cases (since I'd imagine that most users tend to prefer a few units at a time, depending on their application). * Optimize memoize function This should be just a little bit faster than before by using Maps, which have less overhead than javascript objects.
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