Skip to content

Instantly share code, notes, and snippets.

@bantya
Last active May 24, 2018 17:48
Show Gist options
  • Select an option

  • Save bantya/483407c271d667ffa24431f88c4234e0 to your computer and use it in GitHub Desktop.

Select an option

Save bantya/483407c271d667ffa24431f88c4234e0 to your computer and use it in GitHub Desktop.
PHP: Speed test placeholder
<?php
// Adapted from: https://r.je/sprintf.html
$iterations = 500000;
$t1 = microtime(true);
for ($i = 0; $i < $iterations; $i++) {
// Test operation 1 here
}
$t2 = microtime(true);
echo 'strongTest1: ' . ($t2-$t1);
echo '<br />';
$t1 = microtime(true);
for ($i = 0; $i < $iterations; $i++) {
// Test operation 2 here
}
$t2 = microtime(true);
echo 'Test2: ' . ($t2-$t1);
echo '<br />';
die;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment