[Phplib-users] Benchmark of Db class
Brought to you by:
nhruby,
richardarcher
From: Peter B. <re...@f2...> - 2001-10-25 18:44:59
|
Hi, For those of you who haven't seen it yet, http://php.weblogs.com has been benchmarking the database classes. Not surprisingly his DBA comes out fastest (!) with PHPLib a close second. I have been looking at the source code of the PHPLib benchmark and wondered if it could actually be speeded up? -- PHPLib source code - full code from http://phplens.com/lens/adodb/ -- <?php include_once('../../php/phplib-7.2d/php/db_mysql.inc'); $DBNAME = 'PHPLib'; function &Connect() { $db = new DB_Sql(); $db->connect("northwind", "localhost", "root", ""); return $db; } function QueryOnce(&$db,$debug) { $rs = $db->query('select productid,productname,unitsinstock,unitprice from products'); while ($db->next_record()) { $id=$db->Record[0]; $name=$db->Record[1]; $unitsinstock=$db->Record[2]; $unitprice=$db->Record[3]; if ($debug) { print "$id, $name, $unitsinstock, $unitprice<br>"; } } $db->free($rs); } ?> -------------------------------------------- As I see it, he can cut out the db->connect and just put the details in the class file. Would the latest version of db_mysql.inc from CVS make much difference? Also, can anyone tell me what difference in performance there is between $id=$db->Record[0]; and $id=$db->f("productid"); ?? Any feedback gratefully received, and if there's any changes then I'll pass them on to John Lim. Cheers! Peter. -- Maple Design - web design, custom programming. No job too small. And ridiculously low prices! http://www.mapledesign.co.uk |