[limb-svn] r6881 - 3.x/trunk/limb/dbal/tests/bench
svn at limb-project.com
svn at limb-project.com
Tue Apr 1 00:06:48 MSD 2008
Author: pachanga
Date: 2008-04-01 00:06:48 +0400 (Tue, 01 Apr 2008)
New Revision: 6881
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6881
Modified:
3.x/trunk/limb/dbal/tests/bench/fetching.php
3.x/trunk/limb/dbal/tests/bench/fetching_linter.php
3.x/trunk/limb/dbal/tests/bench/fetching_mysql.php
Log:
-- making sqlite bench more isolated
Modified: 3.x/trunk/limb/dbal/tests/bench/fetching.php
===================================================================
--- 3.x/trunk/limb/dbal/tests/bench/fetching.php 2008-03-31 19:58:40 UTC (rev 6880)
+++ 3.x/trunk/limb/dbal/tests/bench/fetching.php 2008-03-31 20:06:48 UTC (rev 6881)
@@ -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 "dbal 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);
@@ -62,4 +68,4 @@
echo "lmbSqliteConnection :: newStatement(), getter: " . (microtime(true) - $mark) . "\n";
-unlink('/tmp/benchdb');
+ at unlink('/tmp/benchdb');
Modified: 3.x/trunk/limb/dbal/tests/bench/fetching_linter.php
===================================================================
--- 3.x/trunk/limb/dbal/tests/bench/fetching_linter.php 2008-03-31 19:58:40 UTC (rev 6880)
+++ 3.x/trunk/limb/dbal/tests/bench/fetching_linter.php 2008-03-31 20:06:48 UTC (rev 6881)
@@ -65,4 +65,4 @@
echo "lmbLinterConnection :: newStatement(), getter: " . (microtime(true) - $mark) . "\n";
-linter_close_connect($linter_db);
\ No newline at end of file
+linter_close_connect($linter_db);
Modified: 3.x/trunk/limb/dbal/tests/bench/fetching_mysql.php
===================================================================
--- 3.x/trunk/limb/dbal/tests/bench/fetching_mysql.php 2008-03-31 19:58:40 UTC (rev 6880)
+++ 3.x/trunk/limb/dbal/tests/bench/fetching_mysql.php 2008-03-31 20:06:48 UTC (rev 6881)
@@ -68,4 +68,4 @@
mysql_query("drop table foo");
-mysql_close();
\ No newline at end of file
+mysql_close();
More information about the limb-svn
mailing list