[Expat-discuss] Re: Abort parsing from inside an handler?

Karl Waclawek karl at waclawek.net
Wed Oct 29 09:22:06 EST 2003


> I am parsing with blocks of BUFSIZ size, (about 8192, I think).
> When callbacks are disabled, perhaps Expat still reads 
> the entire block, I don't know. Even if that is the case, the maxium
> delay we have is say 0.1 sec or less, the time to read the block, 
> but not more... even in a relatively old machine as this...
> 
> If someone is using much larger buffers than this, about
> several Megabytes, then I have to say that in my opinion
> that is plain wrong, and the error is in their code, not in Expat.

The effect of buffer size is somewhat a mystery.
One would think that larger buffers require less overhead, which is true,
but with diminishing returns once the extra work of XML_Parse(Buffer) calls
becomes small compared to the rest of buffer processing.

I found the fastest buffer size for me (on Windows) was between 16KBytes
and 128KBytes. Larger buffers tend to slow parsing down (a little), don't
know why.

> It might be worth to optimize this in Expat, but 
> even if everything goes fine, what we are going to gain 
> is about 0.05 sec... for a BUFSIZ buffer, not more! 

You are correct for stopping the parser, but for suspending
it (not yet implemented) we need to stop immediately so that
we don't skip any XML content. 

Karl




More information about the Expat-discuss mailing list