Skip to content

Instantly share code, notes, and snippets.

@bjornstar
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjornstar/92db35bb55d13f26a5fa to your computer and use it in GitHub Desktop.
Save bjornstar/92db35bb55d13f26a5fa to your computer and use it in GitHub Desktop.
rumplestiltskin vs sigmund
var r = require('rumplestiltskin');
var s = require('sigmund');
var a = [];
function bench(fn) {
console.time(fn.name + ' complex');
for (var i = 0; i < 1000000; i += 1) {
a[i] = fn({ a: 1, b: true, c: null, d: {}, e: [], f: 'asdf', g: { h: { i: '1234' } } });
}
console.timeEnd(fn.name + ' complex');
console.time(fn.name + ' simple');
for (var i = 0; i < 1000000; i += 1) {
a[i] = fn({ a: 'aaaaaaaaaaaaaaaaa' });
}
console.timeEnd(fn.name + ' simple');
}
bench(r.trueName);
bench(s);
{
"name": "object-hash-bench",
"dependencies": {
"rumplestiltskin": "*",
"sigmund": "*"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment