php - How can I benchmark the XML parser of my choice?

137

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.bz2 in case hat you may need it. Thank you!

959

Answer

Solution:

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

200

Answer

Solution:

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).

People are also looking for solutions to the problem: javascript - How do I put id number from select tag to a php link?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.