CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2003
    Posts
    20

    speeding up the parsing

    Hi,

    I have written some code that reads in data from an xml file and inserts the data into variuos database tables.

    The xml file has 7-8 levels of netsing and I am using org.w3c.dom parser to parse the file.

    However, I am not very happy with its performance and think that it can be enhanced.

    Does anyone know of any tricks that can spped this thing up?

  2. #2
    Join Date
    May 2003
    Location
    Denmark
    Posts
    1,315
    Using a SAX parser instead of DOM might speed things up.

  3. #3
    Join Date
    Oct 2003
    Posts
    20
    My manager (who thinks he is Mr know it all) said that he wants me to use DOM so I did. I warned him beforehand that using DOM to parse XML files is not the best way of doing it and could be very slow but his head is too far up his own backside to listen.

    Anyway, are there any faster DOM parsers out there that I could use?

  4. #4
    Join Date
    May 2003
    Location
    Denmark
    Posts
    1,315
    Well you could use Xerces-C++, but of course this requires that you rewrite everything in C++.

    http://xml.apache.org/xerces-c/index.html

  5. #5
    Join Date
    Oct 2003
    Posts
    20
    I am under time restrictions so I can not re-write the code + I don't think I remember anything from my c++ days.

  6. #6
    Join Date
    May 2003
    Location
    Denmark
    Posts
    1,315
    Then your only chance of increasing the preformance, is to run it on a faster machine.

  7. #7
    Join Date
    Oct 2003
    Posts
    20
    The code is running locally and (in my opinion) the performance is appalling but my machine is quite low spec and has very little RAM and disk space so this could be causing the performance problems.

  8. #8
    Join Date
    May 2003
    Location
    Denmark
    Posts
    1,315
    If the system is doing a lot of swapping while the program runs, then you would most probably get a good preformace boost, by adding more ram.

    If there is one thing java does well, it's taking up lots and lots of memory.

  9. #9
    Join Date
    Oct 2003
    Posts
    2
    Your manager is a twit.
    If you can convince him JAXB is a clean cut solution.

    http://developer.java.sun.com/develo...cles/xml/jaxb/
    Trev

  10. #10
    Join Date
    Dec 2002
    Posts
    47
    Well, the Xerces-C++ DOM parser is implemented using SAX so you'd be using SAX whether you wanted to or not. The same is probably true of Xerces-J.

    It doesn't take long to write a SAX handler. 7-8 object classes? Not too bad. If your PHB doesn't want to invest the time then let it go for now. Save your strength for the battles that really matter.

    -rick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured