Skip to content

Instantly share code, notes, and snippets.

@ronan-gloo
Created April 16, 2013 07:36
Show Gist options
  • Save ronan-gloo/5394115 to your computer and use it in GitHub Desktop.
Save ronan-gloo/5394115 to your computer and use it in GitHub Desktop.
<?php
namespace Project\Raw {
define('VT', 100000);
$mt['NS no Backslash']['start'] = microtime(true);
for ($i = 0; $i < VT; $i++) {
is_array(VT);
is_string(VT);
is_object(VT);
is_bool(VT);
is_int(VT);
is_resource(VT);
is_null(VT);
}
$mt['NS no Backslash']['end'] = microtime(true);
}
namespace Project\Slash {
$mt['NS with Backslash']['start'] = microtime(true);
for ($i = 0; $i < VT; $i++) {
\is_array(VT);
\is_string(VT);
\is_object(VT);
\is_bool(VT);
\is_int(VT);
\is_resource(VT);
\is_null(VT);
}
$mt['NS with Backslash']['end'] = microtime(true);
}
namespace {
$mt['NS Global no Backslash']['start'] = microtime(true);
for ($i = 0; $i < VT; $i++) {
is_array(VT);
is_string(VT);
is_object(VT);
is_bool(VT);
is_int(VT);
is_resource(VT);
is_null(VT);
}
$mt['NS Global no Backslash']['end'] = microtime(true);
}
namespace {
$mt['NS Global with Backslash']['start'] = microtime(true);
for ($i = 0; $i < VT; $i++) {
\is_array(VT);
\is_string(VT);
\is_object(VT);
\is_bool(VT);
\is_int(VT);
\is_resource(VT);
\is_null(VT);
}
$mt['NS Global with Backslash']['end'] = microtime(true);
foreach ($mt as $name => $interval)
{
echo round($interval['end'] - $interval['start'], 5).': '.$name.PHP_EOL;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment