Skip to content

Instantly share code, notes, and snippets.

@laruence
Created February 10, 2018 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laruence/3ff688089efd294bea7b33283b030381 to your computer and use it in GitHub Desktop.
Save laruence/3ff688089efd294bea7b33283b030381 to your computer and use it in GitHub Desktop.
<?php
$retry = 100;
$start = microtime(true);
while (--$retry) {
$length = (int)(1000/$retry);
$str = file_get_contents("/dev/urandom", false, NULL, 0, $length);
//echo "String lenght: ", $length, "\n";
$time = microtime(true);
for ($i = 0; $i < 1000000; $i++) {
base64_encode($str);
}
$time = microtime(true) - $time;
//echo "Used time: ", $time , "s", "\n";
}
echo "Total used time: ", microtime(true) - $start, "s\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment