[limb-svn] r6880 - 3.x/trunk/limb/active_record/tests/bench
svn at limb-project.com
svn at limb-project.com
Mon Mar 31 23:58:40 MSD 2008
Author: pachanga
Date: 2008-03-31 23:58:40 +0400 (Mon, 31 Mar 2008)
New Revision: 6880
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6880
Modified:
3.x/trunk/limb/active_record/tests/bench/fetching.php
Log:
-- improving bench tests a bit
Modified: 3.x/trunk/limb/active_record/tests/bench/fetching.php
===================================================================
--- 3.x/trunk/limb/active_record/tests/bench/fetching.php 2008-03-31 19:58:19 UTC (rev 6879)
+++ 3.x/trunk/limb/active_record/tests/bench/fetching.php 2008-03-31 19:58:40 UTC (rev 6880)
@@ -1,6 +1,7 @@
<?php
set_include_path(dirname(__FILE__) . '/../../../../');
+define('LIMB_VAR_DIR', dirname(__FILE__) . '/../../../var/');
$mark = microtime(true);
@@ -9,11 +10,16 @@
echo "active record common includes: " . (microtime(true) - $mark) . "\n";
-if($native_db = sqlite_open('/tmp/benchdb'))
+$db = LIMB_VAR_DIR . '/benchdb';
+if($native_db = sqlite_open($db))
{
- sqlite_query($native_db, 'CREATE TABLE foo (bar varchar(10))');
- sqlite_query($native_db, "INSERT INTO foo VALUES ('some value')");
+ @sqlite_query($native_db, "DROP TABLE foo");
+ sqlite_query($native_db, 'CREATE TABLE foo (id INTEGER PRIMARY KEY, bar VARCHAR(10))');
+ for($i=0;$i<30;$i++)
+ sqlite_query($native_db, "INSERT INTO foo VALUES (null, 'some value$i')");
}
+else
+ throw new Exception("Could not open sqlite db '$db'");
$mark = microtime(true);
@@ -26,7 +32,7 @@
echo "native sqlite fetching: " . (microtime(true) - $mark) . "\n";
-$conn = lmbDBAL :: newConnection('sqlite://localhost//tmp/benchdb');
+$conn = lmbDBAL :: newConnection('sqlite://localhost/' . $db);
$mark = microtime(true);
for($i=0;$i<1000;$i++)
@@ -40,7 +46,7 @@
class Foo extends lmbActiveRecord{}
-lmbActiveRecord :: setDefaultDSN('sqlite://localhost//tmp/benchdb');
+lmbActiveRecord :: setDefaultDSN('sqlite://localhost/' . $db);
$mark = microtime(true);
@@ -75,4 +81,4 @@
echo "Foo fetching, getter: " . (microtime(true) - $mark) . "\n";
-unlink('/tmp/benchdb');
+ at unlink($db);
More information about the limb-svn
mailing list