Re: [xml] lazy libxml

"Oleg A. Paraschenko" <olpa xmlhack ru> writes:

Hello Nic,

On Mon, 19 Jun 2006 13:50:42 +0100
Nic James Ferrier <nferrier tapsellferrier co uk> wrote:

I want a lazy implementation of libxml for my XRT project.

I am collecting my thoughts on how to build lazyness into libxml2.

I'm not a libxml developer, but I think that it's just impossible.

Nothing is impossible.

I still think this would be a nice idea... I don't even think it would
be that hard to implement. What would be hard is maintaining the
separate tree with the lazy patches in until Daniel was convinced

However, I am pursuing the idea of directly expressed lazyness managed
by the dyn:evaluate function, eg:

  <xsl:variable name="x" select="'functioncall()'"/>
  <xsl:value-of select="dyn:evaluate($x)"/>

I'm pretty sure I can achieve what I want with only this.

If anyone has any views on how to do it, or has already done any work
on it then please contact me, or make suggestions on this thread.

In XSieve I played with lazyness. XSieve is a hybrid of XSLT and Scheme.
On the Scheme side, the XML data is automatically represented as SXML.
Initially, I used the lazy conversion. Than I switched to full conversion,
without on-demand tricks. Result is: the code is much faster. Yes, the
lazy version drained performance by checking if something is already
instantiated or not.

That's right.

Lazyness can be handled really badly. There are some lazy
instantiation systems in Java that have similar performance penalties.

But XRTs use of lazyness would be to delay all operations on big
datums until the operations can be performed more sensibly.

For example:

   <xsl:variable name="pngfile" select="lazy(document('some.png'))"/>
   <xsl:variable name="jpgfile" select="lazy(convert($pngfile, 'jpg'))"/>

If I have the variable jpgfile at HTTP output time I could turn the
functional conversion into a stacked stream conversion.

With any technique there are advantages and disadvantages. It's an
interesting point that many of the techniques from recent computer
science that are supposed to make things easier (tail call
elimination, continuations, lazyness) are actually fraught with
practical difficulties.

Nic Ferrier   for all your tapsell ferrier needs

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]