The same algorithm was written three times and measured on line count, file size, and runtime. The three languages did not agree on a winner.

Choosing a language for an algorithm is usually settled by preference. The team behind this study turned it into a measurement instead, by writing the same genetic algorithm in three languages.
The problem was the Travelling Salesperson Problem, the classic task of finding the shortest route that visits every city once. It is NP-hard, which makes it a natural target for a genetic algorithm. Instead of searching every route, the algorithm evolves a population of candidate routes over generations and keeps the better ones.
The same pseudo code became a Python, a PHP, and a Ruby implementation. Every method was unit tested so that the three behaved identically, then each was run with the same settings: 100 maximum generations, five individuals per generation, a 90 percent crossover rate, and a 1 percent mutation rate.
Runs covered routes of five cities up to ten, and each configuration was measured ten times so the averages meant something. All three produced the same best individual at the same generation, which is what makes the timing comparison fair.

Python was shortest to write, at 237 lines. PHP took 280, and Ruby 302. The reason is syntax. Python does not need closing tags on its functions and loops, so the same logic fits in fewer lines.
File size told the opposite story. Python needed the most space at 7771 bytes, against 6786 for PHP and 5703 for Ruby. The authors point to Ruby's style, which packs more into each statement.
Runtime is where the decision gets made. Ruby was faster than both, improving on Python by roughly 6.5 to 9.99 percent, while PHP ran 0.22 to 6.09 percent slower than Python. That is why the authors recommend Ruby for this kind of work.

The limits are worth keeping in view. This is one algorithm, one problem, and a test set of at most ten cities. The finding is about the interpreter and the style it encourages, not about which language is fastest in every situation.
Pinandito et al. (2018). Web-Based Implementation of Travelling Salesperson Problem Using Genetic Algorithm: A Comparative Study of Python, PHP, and Ruby. arXiv preprint.