On Friday 24 October 2003 13:11, you wrote:
> Zoran Vasiljevic said:
> > Hehe... Should we elect this to be "The Quoute Of The Week"?
>
> Did I mention the 2ms value was including reading both files from disk?
> (which I wouldn't be doing in production, the xml is generated and I would
> keep the xsl in memory) If I skip the reading of the files and let time do
> 1000 iterations it is 1145 microseconds per iteration. And this is on a
> lowly Athlon 850.
>
> It is amazing, though, how fast your memory usage goes up and the parser
> slows down if you forget to do `$doc delete`! ;-)
>

I have written a small dom doc cacher in Tcl which allows you to
preparse xslt docs and keep them sticky in memory.
This way you load/parse xslt stylesheets once. When you need one,
just pop it from the cache, apply it and push it back.
This was written for illustration purposes of the "dom attachDocument"
and "dom detachDocument" for people at AOL, but its very useful
for all kind of purposes.  This way you need not care about the
"$doc delete" since it is handled by the wrapper.
Morevoer, the 0.7.8 tdom had a trouble spot where we were loosing
speed if large number of docs have been created (in excess of 1000's).
This has now been rewritten in 0.8.0 (not yet officially released) so the
speed is constant, regardless of the number of created docs.

But, bottom line: always drop dom docs if not needed any more.
This saves memory. You can automate this task by:

dom parse <blabla/> doc

The "doc" variable has a trace on it in this case, and when
it goes out of scope (unset doc) it tears down the underlying
document as well without the need of the explivcit "$doc delete".

You have just started to use tdom. As the way goes by
you will discover other goodies there as well. Please feel
free to ask any questions regarding the tdom on the tdom
mailing list (mentioned on the www.tdom.org). We, that is
Rolf, Jochen and myself monitor that and we'll be glad
to help.

Cheer's
Zoran


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to