[Lazarus] Why is SAX so slow?

Marco van de Voort marcov at stack.nl
Mon Dec 26 20:24:00 CET 2016


On Sun, Dec 25, 2016 at 12:47:15PM +0100, Werner Pamler via Lazarus wrote:
> Motivated by a user comment on excessive memory consumption of 
> fpspreadsheet during reading of large xlsx files 
> (http://forum.lazarus.freepascal.org/index.php/topic,33292.msg231598.html#msg231598) 
> I began to investigate an alternative approach to read xlsx files based 
> on SAX instead of DOM which is currently used.

The sax one uses FCL XML routines that are widestring based, and you force
them into an ansistring stringlist.

The dom one uses the lazarus XML units, which are 1-byte.

So it is apple and oranges, benchmarking two different XML libs, and on top
of that, the Sax example has to do a lot of string conversion, and the dom
one not or less.

To make things more comparable you could try to use the FCL XML dom units,
or change/port the sax units to use the laz_* versions.



More information about the Lazarus mailing list