RE: [PEAR-DEV] MDB slower than DB ?
| From: | Lukas Smith | Date: | Fri, 13 Dec 2002 14:16:56 +0000 |
| Subject: | RE: [PEAR-DEV] MDB slower than DB ? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-11612@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
> Sent: Friday, December 13, 2002 3:14 PM
> To: smith@dybnet.de; pear-dev@lists.php.net
> Subject: Re: [PEAR-DEV] MDB slower than DB ?
>
> <smith@dybnet.de> wrote :
> >>
> >> Could this be slower because of getOne() ?
> >
> > PEAR::DB does something very uncouth in the get*() methods:
> > The methods are very long instead of separating the different task
into
> > smaller methods. MDB uses the fetch*() methods in its get*() methods
to
> > make the code easier to read and maintain. Obviously this adds
another
> > function call. So maybe its another case of maintainability vs.
> > performance.
> >
> > If you do not intent to pass a prepared query to getOne() then
probably
> > what you really want to use is queryOne() which is slightly lighter
than
> > getOne() since it does not allow you to pass prepared query
parameters.
> >
> > So maybe you will be able to regain some of your lost performance
using
> > queryOne().
> >
> > The applies for all other get*() methods as well: if you dont want
to
> > use prepared queries with it rather use query*() ...
> >
> > Finally MDB has a larger memory footprint for obvious reasons which
can
> > obviously fill up your memory faster but if that would happen
> > performance would probably be very miserable for you.
>
> Memory is not a problem for me :)
> I changed all getOne to queryOne and it's indeed faster.
> Still, it's slower than PEAR DB.
>
> Pear DB is 0.40
> MDB getOne is 0.49
> MDB queryOne is 0.44
>
> Let me know if you can think of any other performance optimization
> settings.
Hmm I doubt there is anything you can do, aside from using fetchInto :-)
The option of having datatype conversion in there means that there will
be some overhead just for checking if you want to use it. The other
option would be to simply copy the fetch*() methods directly into get*()
and query*() but this would make the code bloated and redundant.
Obviously it would be faster because it would safe one function call.
Regards,
Lukas