PEAR DB - performance
| From: | Bojan Mihelac | Date: | Mon, 29 Mar 2004 19:27:58 +0000 |
| Subject: | PEAR DB - performance | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-26857@lists.php.net to get a copy of this message | ||
Hi all,
as I am new in this list excuse me if I write what has already been discussed here...
I noticed very poor performances of DB package, after doing some research on web i found one benchmark which stated that DB is slower than native mysql calls 150%. As DB package has great design and features (especially unique sequences on database level) I spent last two days trying to find some solution to avoid going back and programming without abstraction class.
I am suspicious that one of the bottleneck could be DB_Result and fetching row's from another class (DB_mysql in my case), so I made a test where I created subclass of DB_mysql with folowing these methods:
- fQuery, fExecute (same as query, execute, except it returns mysql resource instead of reference to a DB_Result object)
- fetchRow (which is now in subclass of DB_common instead in DB_Result)
- getAll, getOne, getRow (all functions calls fQuery or fExecute)
All these makes a DB_Result class obsolete and bechmarks shows the 18,2% better performance. Details are on bottom of the page.
I would like to hear comments about this.
Sincerly,
Bojan Mihelac
First column is new class, and second column is DB_mysql class
(based on loading about 100 rows from database, one by one).
0,214892 0,272989 0,200177 0,235109 0,206415 0,242961 0,226419 0,250914 0,199662 0,26183 0,208013 0,268004 0,189624 0,262519 0,237911 0,256503 0,200927 0,238729 0,199915 0,260106.-- Bojan Mihelac Informatika Mihelac, Bojan Mihelac s.p. Dolenjska cesta 54, 1000 Ljubljana, SI http://www.mihelac.org