PEAR vs Modules [A story to learn from]

Do you have questions regarding Pecl or Pear? ask here!

Moderators: egami, macek, gesf

Post Reply
User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2213
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Fri May 13, 2005 1:46 pm

Hi everyone!

Several month ago we had to develop an application that shouldve been able to connect to different database engins without code rewriting: using some common DB class. Well we had to choises: PEAR::DB or writing our own. Before we bade a decision: i had to do some serious testings and here is what conclusion i came to:

PEAR::DB is 2-4 times slower then modules (even thou the difference for a single user is not noticeble)

Ofcource in applications that do not need extremely high performance: there is no need in running after the fastest solution. But in our case we need the best solution. The solution was writing our own, light-weighted class that would do exactly what we needed and, at the same time internal php functions.

The class might take some time for you to write (for us a basic class took about 1 hour with support for 6 database engines) but trust me: its worth it.
You have the full controll over the class and can customize it any way you like.

Yes. its possible to customize pear as well. And no, im not saying that pear is bad or you shouldnt use it. No, no : use it as there is no need for reinventing the wheel. But ONLY in the case where the fastest solution was needed: creating own class that would use modules was the best solution.

So when you have some big project that will have to be portable: think about it!
Best Regards,
Alexej Kubarev
Zend Certified Engineer
Image Image

Fri Oct 14, 2011 4:20 am

Maybe you could share some of that good stuff with us struggling in the pits.
Post Reply