What is the fastest XML Parser available for Delphi?

some time ago I had to serialize record to XML format; for ex:

 TTest = record
    a : integer;
    b : real; 
 end;

to

    <Data>
        <a type="tkInteger">value</a>
        <b type="tkFloat">value</b>
    </Data>

I used RTTI to recursively navigate through record fields and storing values to XML.
I’ve tried few XML Parsers. I did’t need DOM model to create xml, but needed it to load it back.

XML contained about 310k nodes (10-15MBytes);
results presented in table below, there are 6 columns with time in seconds;
1 – time for creating nodes and write values
2 – SaveToFile();
3 = 1 + 2
4 – LoadFromFile();
5 – navigate through nodes and read values
6 = 4 + 5
enter image description here

MSXML/Xerces/ADOM – are differend vendors for TXMLDocument (DOMVendor)
JanXML doesn’t work with unicode; I fixed some errors, and saved XML, but loading causes AV (or stack overflow, I don’t remember);
manual – means manually writing XML using TStringStream.

I used Delphi2010, Win7x32, Q8200 CPU/2.3GHz, 4Gb of RAM.

update: You can download source code for this test (record serialization to XML using RTTI) here http://blog.karelia.pro/teran/files/2012/03/XMLTest.zip All parsers (Omni, Native, Jan) are included (now nodes count in XML is about 270k), sorry there are no comments in code.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)