You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Rob Parker <ro...@webcybernetics.com> on 2000/05/02 12:48:20 UTC

SAX Event cacheing & Generators

I've been playing around with cacheing SAX Events. My motivation was to
implement something similar to the FileGenerator - without the overhead
of reading/parsing a file every request.

Option 1 - cacheing the file contents as a String and parsing the String at
each request. (Uses memory but removes the file read overhead.)

Option 2 - parse the file once and build a list of 'pointers to callback functions' using
the Method class, at each request, just run through the list and call the invoke method.
(Uses less memory than option 1 and may be faster)

In my experience, If virtual callback methods are used, option 2 is slightly slower than option 1. If static
callback methods are used, option 2 is much quicker than option 1.

If this is of value to any Cocoon developers, then let me know.

regards

Rob


Re: SAX Event cacheing & Generators

Posted by Rob Parker <ro...@webcybernetics.com>.
I'm curious to know how this will be implemented in Cocoon2 - I'm familiar
with the Cocoon1.x code

----- Original Message ----- 
From: Giacomo Pati <Gi...@pwr.ch>
To: <co...@xml.apache.org>
Sent: Wednesday, May 03, 2000 4:10 AM
Subject: Re: SAX Event cacheing & Generators


> > Rob Parker wrote:
> > 
> > I've been playing around with cacheing SAX Events. My motivation was
> > to
> > implement something similar to the FileGenerator - without the
> > overhead
> > of reading/parsing a file every request.
> 
> XSP addresses this as well. It builds a Generator (java class) from the
> xml file on the first request and uses that class to spit out SAX Events
> for this and every following request (as long as the xml file has not
> changed).
> 
> Giacomo
> 
> 
> -- 
> PWR Organisation & Entwicklung            Tel:   +41 (0)1 856 2202
> Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
> Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
> CH-8166 Niederweningen                    Web:   http://www.pwr.ch
> 


Re: SAX Event cacheing & Generators

Posted by Giacomo Pati <Gi...@pwr.ch>.
> Rob Parker wrote:
> 
> I've been playing around with cacheing SAX Events. My motivation was
> to
> implement something similar to the FileGenerator - without the
> overhead
> of reading/parsing a file every request.

XSP addresses this as well. It builds a Generator (java class) from the
xml file on the first request and uses that class to spit out SAX Events
for this and every following request (as long as the xml file has not
changed).

Giacomo


-- 
PWR Organisation & Entwicklung            Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch