I currently code in PHP. Recently I've been working on a project using PHP and Symfony that:reads large XML files (lots of DOM parsing/reading),converts large XML files to large arrays,merges 2 large arrays (lots of array sorting),takes the 2 large arrays and turns them into a large CSV file.I finished it in PHP but now it is kind of memory intensive and requires about 8-15 seconds to run. So now I have the following options and need help choosing one:Try rewriting/refactoring it using better methods in PHPChoose a different programming language (I have been wanting to learn one, possibly another language processes these things a lot faster?)Do 1 or 2 and additionally set up something to be constantly reading xml files and write them to MongoDB documents to serve clients from the database instead of scrapping the data. I am inclined to do 2 or 3 (using a different language), since I am sure there is another language that handles these kind of tasks much faster (e.g Python, C etc.). It's just that I am not sure which.
What programming language to choose for this XML and data processing task?
programming languages;php;xml;language choice
Before choosing a different language, first make sure the language is the bottleneck. So did you actually measure the time for the 4 steps? Do you know that, for example, most waiting time for step 1 is spend in your language interpreter (and not caused by disk IO)? If the latter is the case, then chosing a language like C++ (or even assembler) may not bring you any relevant speed increasement. XML processing is often dependent on the speed of the XML parser, so that may be the next thing to look at, something that is only partially language dependent. libxml is very fast, it is a C library, but also available as a PHP extension. Building large arrays may be speeded up by a language change, sorting, however, probably not (or not much), if you are using the builtin sort function of PHP (which is a library function coded most probably in C or C++ itself). And writing data into a file is mostly dominated by disk I/O  - again something where another language won't help.So first make sure where the real problem is, otherwise you will be astonished how wrong one can be when making assumptions in optimizing without measuring.