Skip to content

Instantly share code, notes, and snippets.

@vojkny
Created August 20, 2011 18:37
Show Gist options
  • Save vojkny/1159468 to your computer and use it in GitHub Desktop.
Save vojkny/1159468 to your computer and use it in GitHub Desktop.
benchmark.php
<?php
// to be run from commandline with apache benchmarking tool 'ab' as:
// $ ab -n 100 http://site/benchmark.php
function test() {
function fun() {return (3.75*0.12345*12345*9.999);};
$start = microtime(true);
$s = 'php';
for ($i = 0; $i < call_user_func('fun'); $i += (0.47373 + 2494.9999%2494.5555)) {
$s = preg_replace('#[02468]#', 'X', sha1(md5($s)));
}
return microtime(true) - $start;
}
echo test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment