Well, then. On each machine, install the version of everything (or one thing at a time) mentioned above that exists on the other machine, and see if the programm gets faster or slower. Yes, it involves work.
Getting well off-topic now, but do bear in mind that newer versions of MySQL use InnoDB as the default storage engine, whereas older versions use MyISAM. Make sure that your tables on the different servers are using the same storage engine as that could account for big differences in times of operations.