Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDomDocument vs libxml2 on Performance
Forum Updated to NodeBB v4.3 + New Features

QDomDocument vs libxml2 on Performance

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ModelTechM Offline
    ModelTechM Offline
    ModelTech
    wrote on last edited by ModelTech
    #1

    I have rewritten my old libxml2-based parser using QDomDocument. The parsing is done in somewhat different way than my old parser, as the purpose is to now have a nice GUI instead of just a command line tool. Unfortunately, the parsing has become really a lot slower: from less than a second with the old libxml2-based parser to 8+ minutes with the QDomDocument-based parser. Since this is a rather big difference, I was wondering whether QDomDocument is known to be slower than libxml2 for the very same parsing algorithm. Your comments are welcome.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What size/complexity is your document ? One of the thing to take into account is that QDomDocument will load your complete file in-memory. Is this really what you need ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • ModelTechM Offline
        ModelTechM Offline
        ModelTech
        wrote on last edited by ModelTech
        #3

        One of the examples is 5MB in file size and that is by far not the biggest example that I have. I do need to go through the DOM tree a few times and sometime combine things at different places in the DOM tree to parse things correctly, so QXmlStreamReader is no option. My biggest worry is not so much the memory consumption (at least at the moment) but the time it takes...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          AFAIK, libxml2 outperforms QDomDocument.

          Depending on your needs, implementing a small wrapper around it might be better.

          What would your GUI do with these files ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved