Re: DB_DataObject performance
| From: | Alan Knowles | Date: | Tue, 01 Nov 2005 02:09:09 +0000 |
| Subject: | Re: DB_DataObject performance | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-40368@lists.php.net to get a copy of this message | ||
On Mon, 2005-10-31 at 09:24 -0800, Ian Eure wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> >
> I've tried. I did not have very good success. It's my opinion that
> DB_DataObject is much too heavyweight, and I ran into memory
> consumption issues when working with many DataObject instances.
> Sloccount reports DataObject.php as having 2,129 physical lines of
> code; the actual file is 3,921 lines.
50% comments or white space ;) - not badly documented ;)
I'm not sure that this would be the major factor for performance /
memory issues. (if you do have a highly loaded site, compiler caches are
essential, in which case this is expected to be irrelivant)... although
It could probably do with a bit of a diet (maybe moving Validation/Table
join stuff into another class)
>
> But the main issue I found was memory consumption, so watch for that.
If you do run into issues like this, the free() method may be what is
needed..
>
> My suggestion? Avoid DBDO, and use DB_FETCHMODE_OBJECT and/or
> DB_Table. With some clever coding of a class for DB's objectClass,
> you can get almost every benefit of DBDO, without the headaches.
Obviously a trade off, all Dataobjects features save you a huge amount
of time in development and future maintenaince. for the small penalty
that you may have to work a bit harder to optimize it (In the rare
instances that you end up with high loads). - and how does your time
cost in comparison to buying the 500Mb memory chip??
There is quite a bit of performance code and performance review code
built into the debug output (query review, explain / timing etc.)
Regards
Alan
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (Darwin)
>
> iD8DBQFDZlNGxuUdPD6j2IMRAs+eAKDOXPK+gGxscc4Oap4owQoXVCi7PgCdHQu4
> fiJVL+Q4/rTj5TJn8FQ9H7Q=
> =Wmgd
> -----END PGP SIGNATURE-----
>