I was curious how each of the options performed, so I put together the attached demo. Ironically, the option with the word "Fast" in its name... wasn't really all that fast. Go figure.
Thank you, dsiders, for this demo. This is the first time that I see the sax reader in action explicitely.
Nevertheless, I doubt whether this speed test is of any value to see the speed differences between the three parsers. This is because you add the parsed results to a listview, and this introduces a lot of overhead. Moreover, the tests are not written inconsistently, in one test clearing the listview is included in the measurement code, as well as extraction of the html from the memo.Text (but this is negligible in comparison with the first issue).
I rewrote the demo so that the results are first written to a stringlist. Now the time to parse your (small) demo file is displayed as 0 ms for all three cases. Found an html file in the docs/html/lazutils folder which is greater than 1 MB (uni936c.html), and for this the times are measured as follows:
- fasthtmlparser: 31 ms
- SAX parser: 187 ms
- DOM parser: 656 ms.
(The time to display the output in the listview, however, is "endless", about 1 minute so so. Should do this in virtual mode, but did not want to spend so much time on it).