How to solve the XML parsing performance issue on Android

后端 未结 8 1879
耶瑟儿~
耶瑟儿~ 2020-12-25 08:31

I have to read a XML file with about ~4000 lines on Android. First I tried the SimpleXML library because it\'s the easiest and it took about 2 minutes on my HTC Desire. So I

8条回答
  •  遥遥无期
    2020-12-25 08:46

    Using the SAX parser, I can parse a 15,000-line XML file in around 10 seconds on my HTC Desire. I suspect there is some other issue involved.

    Are you populating a database from the XML? If so, are you remembering to wrap your entire parse operation in a DB transaction? That alone can speed things up by an order of magnitude.

提交回复
热议问题