[Petal] Petal performance
jhiver at mkdoc.com
jhiver at mkdoc.com
Sun Mar 9 16:14:42 GMT 2003
Hi Mark,
> I've been trying to track down some bottlenecks in a site i'm developing.
> Running things through Dprof shows Petal taking well over 70% of all
> processing time. I've got all caching turned on but it doesn't seem to
> help that much.
Well, since in-memory caching only happens in subsequent requests under
mod_perl, I wouldn't expect dprofpp to pick these memory caching up since
I suppose that you run it on the command line.
If you could come up with a little benchmark script with a decently sized
data structure (possibly a data dump) and decently sized templates, it
would me easier for me to toy around with the Perl profiler!
> The area where I've really come across a performance hit is with recursive
> Xincludes. Processing even a midly complex tree structure really begins to
> take ages.
Each time an include happens a new Petal object is created, however i would
not expect that to take ages.
One thing you need to be aware of is that when you use petal:repeat, a copy
of the hash is made for each iteration. This is necessary to get a correct
behavior
(variable scoping...), however if that is the problem I could implement a
switch
to disable this behavior I guess.
> How much work would it be to get Petal to use an XS engine? Would the
> performance gain be much? If you think it's worth it, then please can I
> put it on your TODO list? ;)
But it is one my TODO list already, I just haven't got around to moving it
on my DONE list yet!
I think coming up with a crude-but-working hack to use TT2 XS' stash might
take me a couple of days. When I ran my benchmarks most of the CPU cycles
seemed to be crunched by Petal::Hash, so it would obviously be a good
move...
Problem is that I have quite a lot of paid work to get done before the end
of
April, because I'll be on holidays (again!) for a big fortnight at the end
of
April / beginning of May.
Anyway I'll try to address this issue (relatively) quickly. Meanwhile I can
only
recommend my rule #1 in optimizing programs: more RAM, bigger CPUs and
faster hard disks :-)
Maybe you could post the results of your dprofpp on the list, preferently
with
different options (most frequently called functions, most time crunching
functions,
etc) so that we could discuss possible areas of improvement on the list...
someone
might just have a good idea by just looking at the Dprof reports...
> ps. On a side note, a few weeks ago I asked about using cursors in Petal.
> Well, your suggestion of using a tied array worked beautifully - thanks :)
> At some point I'll try and knock up a quick howto and put it on the Petal
> website.
Many thanks for planning on documenting what you did.
I'm glad it worked nicely. Perl is such a cool, flexible language! You can
hack
and override almost anything, it's very handy.
All the best,
Jean-Michel.
More information about the Petal
mailing list