bit computation

Benchmark created on


Description

Measure the speed of bit computation

Setup

const array = [];
for (let i = 0; i < 10000; i++) {
    array.push(Math.random());
}

// bit
function a(arr) {
    for (let i = 0, len = arr.length; i < len; i++) {
        arr[i] <<= 1;
    }
    return arr;
}

// notbit
function b(arr) {
    return arr.map(function(element) {
        return element * 2;
    });
}


Test runner

Ready to run.

Testing in
TestOps/sec
bit
a(array);
ready
not bit
b(array);
ready

Revisions

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