Skip to content

Instantly share code, notes, and snippets.

@arnaud-lb
Created October 22, 2012 14:02
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 arnaud-lb/63bb06c4519e7395b381 to your computer and use it in GitHub Desktop.
Save arnaud-lb/63bb06c4519e7395b381 to your computer and use it in GitHub Desktop.
<?php
$code = $dumper->dump($options);
eval('?'.'>'.$code);
$context = new RequestContext;
$matcher = new \ProjectUrlMatcher($context);
$paths = [
'/foo/baz',
'/bar/foo',
'/barhead/foo',
'/test/baz',
'/test/baz.html',
'/test/baz3/',
'/test/foo/',
'/test/foopost/',
'/test/fooput/',
'/foofoo',
'/\'\'\'\'',
'/spa ce',
'/a/b\'b/foo',
'/a/b\'b/bar',
'/a/foo',
'/a/b\'b/foo',
'/a/b\'b/bar',
'/multi/hello/who',
'/multi/new',
'/multi/hey/',
'/fr/b/foo',
'/fr/b/foo',
'/ababa',
'/aba/foo',
'/a/a...',
'/a/b/foo',
'/a/b/c/var',
];
$times = [];
foreach ($paths as $path) {
$start = microtime(true);
for ($i = 0; $i < 50000; ++$i) {
$matcher->match($path);
}
$time = microtime(true) - $start;
$times[$path] = $time;
fputcsv(STDERR, [$path, $time], "\t");
}
fputcsv(STDERR, ['avg', array_sum($times)/count($times)], "\t");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment