Skip to content

Instantly share code, notes, and snippets.

@natanfelles
Created December 10, 2018 20:29
Show Gist options
  • Save natanfelles/1e9e8211323c180456060c8948b7e10d to your computer and use it in GitHub Desktop.
Save natanfelles/1e9e8211323c180456060c8948b7e10d to your computer and use it in GitHub Desktop.
<?php
//https://3v4l.org/IoNmr
$dir = null;
$m = memory_get_usage();
$t = microtime(true);
for($i = 0; $i < 10000; $i++)
{
$dir = \dirname('/etc/crontab');
}
var_dump(
memory_get_usage() - $m,
microtime(true) - $t
);
echo $dir. "\n";
$m = memory_get_usage();
$t = microtime(true);
for($i = 0; $i < 10000; $i++)
{
$dir = \pathinfo('/etc/crontab', \PATHINFO_DIRNAME);
}
var_dump(
memory_get_usage() - $m,
microtime(true) - $t
);
echo $dir. "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment