First of all, this isn't trying to bash on Python. This is just an example of performance differences between two languages. I know there are ways to optimize both, that is why I took the naive approach using the first Googled result for "Bubble Sort" with each language. Needless to say, I wouldn't recommend using the above code, or bubble sort in production code.
They both use the same data (below) with 10,000 random integers ranging from 1 to 1,000,000,000 from Random.org
- Python = 22.629512548446655 seconds
- Delphi = 0.000003171 seconds
- Delphi is roughly 7 million times faster.
I could use a more accurate time measurement in Delphi, but I don't think that would matter for the orders of magnitude we are looking at here.
Please run these tests yourself and get your own results.