Skip to content

Instantly share code, notes, and snippets.

@themasch
Last active December 23, 2015 01:09
Show Gist options
  • Save themasch/6558342 to your computer and use it in GitHub Desktop.
Save themasch/6558342 to your computer and use it in GitHub Desktop.
can someone explain those results?
var log_2 = Math.log(2);
suite('getTagLength', function() {
set('mintime', 1000);
bench('log(x) / log_2', function() {
return ~~(4 - Math.log(0x42 >> 4) / log_2)
})
bench('log(x) / log(2)', function() {
return ~~(4 - Math.log(0x42 >> 4) / Math.log(2))
})
bench('log(x) / 0.69..', function() {
return ~~(4 - Math.log(0x42 >> 4) / 0.6931471805599453)
})
})
var log_2 = Math.log(2);
suite('getTagLength', function() {
set('mintime', 1000);
bench('log(x) / log(2)', function() {
return ~~(4 - Math.log(0x42 >> 4) / Math.log(2))
})
bench('log(x) / 0.69..', function() {
return ~~(4 - Math.log(0x42 >> 4) / 0.6931471805599453)
})
bench('log(x) / log_2', function() {
return ~~(4 - Math.log(0x42 >> 4) / log_2)
})
})
var log_2 = Math.log(2);
suite('getTagLength', function() {
set('mintime', 1000);
bench('log(x) / 0.69..', function() {
return ~~(4 - Math.log(0x42 >> 4) / 0.6931471805599453)
})
bench('log(x) / log(2)', function() {
return ~~(4 - Math.log(0x42 >> 4) / Math.log(2))
})
bench('log(x) / log_2', function() {
return ~~(4 - Math.log(0x42 >> 4) / log_2)
})
})
% node_modules/.bin/matcha bench/getTagLength.js
getTagLength
93,236,704 op/s » log(x) / log_2
140,360,674 op/s » log(x) / log(2)
139,952,917 op/s » log(x) / 0.69..
Suites: 1
Benches: 3
Elapsed: 6,668.10 ms
% node_modules/.bin/matcha bench/getTagLength.js
getTagLength
183,043,511 op/s » log(x) / log(2)
140,520,261 op/s » log(x) / 0.69..
75,107,261 op/s » log(x) / log_2
Suites: 1
Benches: 3
Elapsed: 6,172.77 ms
% node_modules/.bin/matcha bench/getTagLength.js
getTagLength
163,974,921 op/s » log(x) / 0.69..
122,013,489 op/s » log(x) / log(2)
64,790,185 op/s » log(x) / log_2
Suites: 1
Benches: 3
Elapsed: 7,422.99 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment