Q:

PHP vs. Javascript Efficient XML Parser

I am curious, I am creating a flickr plugin for wordpress. I have noticed that the PHP that I have written is fairly slower then the same javascript I have written.
I know that Javascript is run client side so it will be faster as long as there aren't numerous processes already hogging the processor. With PHP running remotely I know that it is all based on connection and what is going on with the server. I was wondering if one was better to use than the other and if DOM is maybe not the best way to go grab XML. In this case in PHP I am using DOM to go and get the XML and then parse it out. With Javascript I am using SOAP to parse the same XML.

A:

Assumption

JavaScript is required for this plugin.
JavaScript testing was only done on your development machine.

I think you need to rethink your metrics. In your particular case JavaScript is faster than PHP, but I don't see that being the case across the board.  I'm assuming you're on shared hosting as are probably most end users of your plugin, so your PHP will not be on the fastest servers.  Like Rory said above. It is best to diagnosis why your PHP is slow. With JavaScript you have to take into account the average user's device speed which could range anywhere from awful to amazing.  My guess is your PC is somewhere near the higher end of the spectrum.
Without any code provided it's tough to give a definitive answer.  I would recommend trying your JavaScript version of the plugin on as variable a range of devices and browsers as possible.  Hitting on things like iPads and cellphones.
Due to that JavaScript potential performance pitfalls on low-end devices, I would probably perform the task on the server unless investigation shows that, in your case, the JavaScript is performant across the board.

