Actually, it starts from https://stackoverflow.com/questions/111368/how-do-you-performance-test-javascript-code
The shortest answer here is, use performance.now()
I created a project to help share this easily, in both Node.js and Browser environments.
patarapolw / js-benchmark
A simple suite to test benchmark for Node.js and web browser
js-benchmark
A simple suite to test benchmark for Node.js and web browser
Tests
For Node version, see /results
For browser version, see https://patarapolw.github.io/js-benchmark
Inspiration
https://stackoverflow.com/questions/111368/how-do-you-performance-test-javascript-code
Creating your own test
Node version
- Clone this project
- Run
npm install
oryarn install
- Write test suite in
/node/suite.js
- Run
npm start
oryarn start
Browser version
- Fork this project
- Clone to your computer
- Run
npm install
oryarn install
- Write test suites in /browser/tests
- Run
npm run browser:create
oryarn browser:create
to create/dist
folder - Open
/dist/index.html
to view your results - To deploy to GitHub Pages, simply rum
npm run deploy
oryarn deploy
Top comments (0)