- Edited
BENCHMARK
1.008 Crypto
1.003 Math
1.004 String
3.015 Sec.
The benchmark is adjusted to give 1 second per each in my PHP. Total like 3 seconds.
How good this is I don't know. But the PHP server is in my own PC.
Simply run the code to get your values.
You can inform me of it here.
How can we make better benchmarks?
Your suggestions are welcome.
<?php
$start = microtime(true);
for ($i=0; $i<297500; $i++) {
$text = "The quick brown fox jumps over the lazy dog";
$key = openssl_digest('secret', 'sha256');
$iv = 'ff91a6a3e4c88597';
$data = openssl_encrypt($text, 'aes-256-ctr', $key, 0, $iv);
$string = openssl_decrypt($data, 'aes-256-ctr', $key, 0, $iv);
}
$result1 = number_format(microtime(true) - $start, 3);
$start = microtime(true);
for ($i=0; $i<4560000; $i++) {
$mat = ((2**17) / 10.13) + 43670 - (11000 * 5);
$log = 5 * log10(107) + 319 * log10(357);
$res = cos(45*pi()/180) * sin(45*pi()/180);
}
$result2 = number_format(microtime(true) - $start, 3);
$start = microtime(true);
for ($i=0; $i<419500; $i++) {
$text = "The quick brown fox jumps over the lazy dog";
$text = str_ireplace('the', 'one', $text);
$text = substr($text, 8, 8);
}
$result3 = number_format(microtime(true) - $start, 3);
echo 'BENCHMARK<br>';
echo $result1.' Crypto<br>';
echo $result2.' Math<br>';
echo $result3.' String<br>';
echo '==========<br>';
echo number_format($result1 + $result2 + $result3, 3).' Sec.';
?>