Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@samdark
Created September 8, 2013 20:18
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 samdark/6488056 to your computer and use it in GitHub Desktop.
Save samdark/6488056 to your computer and use it in GitHub Desktop.
<?php
$start = microtime(true);
function get_cache_value() {
return rand(0, 100).'test';
}
$results = array();
for ($i=0; $i<1000; $i++) {
$results[] = get_cache_value();
}
printf("Done in: %f s\n", microtime(true) - $start)."\n";
printf("Memory used: %d KB\n", memory_get_peak_usage(true)/1024)."\n";
@samdark
Copy link
Author

samdark commented Sep 10, 2013

Done in: 0.002922 s
Memory used: 256 KB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment