Skip to content

Instantly share code, notes, and snippets.

@gpoole
Last active May 22, 2021 13:00
Show Gist options
  • Save gpoole/dcc40f42354b790db9d6d3182eb79064 to your computer and use it in GitHub Desktop.
Save gpoole/dcc40f42354b790db9d6d3182eb79064 to your computer and use it in GitHub Desktop.
import Benchmark from "benchmark";
import SMath from "smath";
const suite = new Benchmark.Suite();
const smath = new SMath();
let result1 = 0;
suite.add('SMath.sin', () => {
result1 += smath.sin(Math.random());
});
let result2 = 0;
suite.add('Math.sin', () => {
result2 += Math.sin(Math.random());
});
suite.on('cycle', function(event) {
console.log(String(event.target));
})
suite.run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment