[Expat-discuss] Why is expat extremely fast?

Aleix Conchillo Flaqué aleix at member.fsf.org
Tue Mar 10 14:15:55 CET 2009


David Gregorczyk wrote:
> Hey guys,
> 
> I'm a student from the University of Luebeck in Germany. For my diploma
> thesis I've just created a small xml parser of ca. 1000 lines of code and
> compared its speed to the expat parser. My results are poor: my parser's
> speed is only a half of expat's speed. I worked with an endless loop
> performing switch and if structures. Sometimes a callback function requests
> more buffer. Once the loop detects a final flag which is set to 1, it will
> parse the rest of the input stream and exit. The parser works fine but is so
> lame. What's the reason expat reaches such a great performance?
> I've tried to understand the source code and failed :-) It's just confusing
> me. There is so much functionality I do not perform... but my application is
> still slower.
> 
> Is there any trick which makes expat so fast?
> 
> I've searched the internet for an answer, no one could help me. Could you?
> 
> Best regards and many thanks for your replies!
> 

I'm not an Expat expert, but may be your problem is with "...a callback 
function requests more buffer". Does this mean you are allocating memory 
  while parsing? If so, that might be your problem. Memory allocation is 
slow.

Cheers,

Aleix






More information about the Expat-discuss mailing list