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 installoryarn install - Write test suite in
/node/suite.js - Run
npm startoryarn start
Browser version
- Fork this project
- Clone to your computer
- Run
npm installoryarn install - Write test suites in /browser/tests
- Run
npm run browser:createoryarn browser:createto create/distfolder - Open
/dist/index.htmlto view your results - To deploy to GitHub Pages, simply rum
npm run deployoryarn deploy
Top comments (0)