[klutz]Fwd: call tree from portal.php

Rick Emery rick at emery.homelinux.net
Mon Feb 17 15:57:58 PST 2003


Quoting Jan Schneider <jan at horde.org>:

> See attached message.

I was planning to try more clean-up and optimization, but I just haven't had the
time. So, I thought I'd submit what I have so far and see what everybody thinks.

One of the problems I saw with the klutz.profile that Jan posted was that there
are a *lot* of calls for sorting. On my portal page, I display a random comic
each time the portal page refreshes (currently every five minutes). If I
understand the code correctly (*please* let me know if I'm wrong), a Klutz
object is instantiated on each refresh of the portal page. The constructor for
the Klutz class sorts all of the comics by name. So, each time my portal page
refreshes, the comics are sorted. Since I only display one comic on the portal
page, there's no reason to sort the list.

So, the attached patch causes the constructor to default to not sort (but still
allows the constructor to sort in case it's required in the future) and only
sorts the comics when displaying.

This may not be the best solution, and I may not even have the sort in the right
place in comics.php, but I just haven't had time to dive in further and it
should eliminate a lot of function calls in the call tree from portal.php (I
couldn't verify this as I never did get the PEAR apd working). I intend to
revisit this as time permits and hopefully submit additional patches.

As always, I am open to any suggestions/comments/criticism.

Thanks,
Rick


More information about the klutz mailing list