1
0
mirror of synced 2024-12-15 07:36:03 +03:00
doctrine2/draft/test.php

32 lines
676 B
PHP
Raw Normal View History

2007-12-10 23:02:41 +03:00
<?php
2007-12-10 23:40:06 +03:00
function autoload($className)
{
if (class_exists($className, false)) {
return false;
}
2007-12-10 23:02:41 +03:00
2007-12-10 23:40:06 +03:00
$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');
2007-12-10 23:02:41 +03:00
$n = 1000;
$start = microtime(true);
for ($i = 0; $i < $n; $i++) {
2007-12-10 23:40:06 +03:00
$parser = new Doctrine_Query_Parser('SELECT u.name, u.age FROM User u WHERE u.id = ?');
$parser->parse();
2007-12-10 23:02:41 +03:00
}
$end = microtime(true);
printf("Parsed %d queries: %.3f ms per query\n", $n, ($end - $start) / $n * 1000);