Bitshifting vs division by 2

Benchmark created on


Setup

const iterations = 100000000
let result = 0
let i = 0

Test runner

Ready to run.

Testing in
TestOps/sec
division by 2
for (i = 0; i < iterations; i++) {
	result = 10 / 2
}
ready
bitshift
for (i = 0; i < iterations; i++) {
	result = 10 >> 1
}
ready
divide float
for (i = 0; i < iterations; i++) {
	result = 10.19385 / 2
}
ready
bitshift float
for (i = 0; i < iterations; i++) {
	result = 10.19385 >> 1
}
ready

Revisions

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