1
0
mirror of synced 2024-12-15 23:56:02 +03:00
doctrine2/draft/test.php
2007-12-10 20:40:06 +00:00

32 lines
676 B
PHP

<?php
function autoload($className)
{
if (class_exists($className, false)) {
return false;
}
$class = dirname(__FILE__) . DIRECTORY_SEPARATOR
. str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
if (file_exists($class)) {
require_once($class);
return true;
}
return false;
}
spl_autoload_register('autoload');
$n = 1000;
$start = microtime(true);
for ($i = 0; $i < $n; $i++) {
$parser = new Doctrine_Query_Parser('SELECT u.name, u.age FROM User u WHERE u.id = ?');
$parser->parse();
}
$end = microtime(true);
printf("Parsed %d queries: %.3f ms per query\n", $n, ($end - $start) / $n * 1000);