log base 2

Benchmark created by tsaniel on


Description

How fast is the table lookup doing log base 2?

Setup

function log(a){return Math.log(a)/Math.log(2)};
    function lookup(a){return[0,1,28,2,29,14,24,3,30,22,20,15,25,17,4,8,31,27,13,23,21,19,16,7,26,12,18,6,11,5,10,9][(a&-a)*0x077CB531>>>27]};

Test runner

Ready to run.

Testing in
TestOps/sec
Log
for (var i = 2147483648; log(i >>>= 1););
ready
Lookup
for (var i = 2147483648; lookup(i >>>= 1););
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.