I will handle a huge XML file and I will go with XMLReader. Below are three ways to go with, but I need to know which one is the fastest. How can I know this? The planet.xml file is located at http://trash.chregu.tv/planet-big.xml.b开发者_C百科z2 in case hat you may need it. Thank you!
You might want to consider the PHP profiling extension:
http://www.php.net/apd
You can examine the results with pprofp:
http://www.compago.it/php/phpckbk-CHP-21-SECT-3.html
I haven't worked with XML much in PHP, but if you're dealing with a really large file, a streaming parser is the way to go. Reading the whole thing into memory and building a DOM tree is pretty expensive (and may even fail, if the document's too big to hold in memory).
精彩评论