Tag Archives: bitwise operators

PHP Performance: Bitwise Division

Recently I wrote about binary search and then I said that in some languages, like PHP, bitwise division by two is not faster than the typical “/” operator. However I decided to make some experiments and here are the results.

Important Note

It’s very important to say that the following results are dependant from the machine and the environment!

Source Code

Here’s the PHP source code.

function divide($n = 1) 
	$a = microtime(true);
	for ($i = 0; $i < $n; $i++) {
	echo microtime(true) - $a;

Continue reading PHP Performance: Bitwise Division