Skip to content

Instantly share code, notes, and snippets.

@fhinkel
Last active December 6, 2017 13:05
Show Gist options
  • Save fhinkel/819c7292c4f503a5426077aaf0400157 to your computer and use it in GitHub Desktop.
Save fhinkel/819c7292c4f503a5426077aaf0400157 to your computer and use it in GitHub Desktop.
const js = require('./primes.js');
const addon = require('./build/Release/primes.node');
function run(i) {
console.time('Prime in js');
js.prime(i);
console.timeEnd('Prime in js');
console.time('Prime in addon');
addon.prime(i);
console.timeEnd('Prime in addon');
}
for(let i = 0; i < 1000000; i++) {
run(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment