Division vs bit right shift (v3)

Revision 3 of this benchmark created on


Description

Right shift one mask is same as divide by 2 on integers. A right shift operation is much faster than a division op. Most static compilers do this optimization.

Setup

var x = 100;
    var y = 100;

Test runner

Ready to run.

Testing in
TestOps/sec
Division
x = y / 2;
y = x / 2;
ready
Right shift
x = y >> 1;
y = x >> 1;
ready
Best Ever
x = 50;
y = 50;
ready

Revisions

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