January 2018
Intermediate to advanced
332 pages
7h 36m
English
Now that we have a few sorting algorithms listed and implemented, let's quickly take a look at their performance. We briefly talked about some performance enhancements while we were implementing these algorithms; we will try to quantify this performance enhancement.
To do so, we will first install the node module called benchmark to create our test suite:
npm install benchmark --save
Once we have installed the benchmark framework, we can add our tests to a file called benchmark.js at the root of the project, which will run the different sorting algorithms described in the preceding section:
var Benchmark = require('benchmark');var suite = new Benchmark.Suite();var Insertion = require('./sort/insertion');var Merge = ...
Read now
Unlock full access