-
-
Save joshtronic/8310309ab2810a6ecfde to your computer and use it in GitHub Desktop.
Basic PHP benchmarking template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$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