Skip to content

Instantly share code, notes, and snippets.

@joshtronic joshtronic/benchmark.php Secret
Last active Mar 20, 2019

What would you like to do?
Basic PHP benchmarking template
$n = 1000000;
$start_time = microtime(true);
$start_mem = memory_get_usage(true);
for ($i = 0; $i < $n; $i++)
$time = microtime(true) - $start_time;
$mem = memory_get_usage(true) - $start_mem;
echo "Test 1\t{$time}\t{$mem}\n";
// Duplicate lines 5-16 for each block of code you want to test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.