After Gustaff's post about higher level languages possibly having better run time, I remembered a thread we had here, that dealt with just that situation.
The thread ran to 5 pages, so I'll pull the highlights together (full thread link):
Python --> C
"Macha" had a problem. His company had hundreds of thousands of tuples that had to be looked at, and those with two or more matching values with any other tuple, needed to be noted, for more analysis.
Macha was familiar with Python, but found the run-time to be VERY long. We asked for, and received from him, a sample file of tuples, that his Python program ran in 4.9 seconds.
Quickly, Salem slaughtered that run time. Perhaps not unexpected, because Salem is a very experienced C programmer. More telling imo, is that two other programmers also did the same thing. My programs run time was 0.05 seconds on his Python data that had a run-time of 4.9 seconds. I'm a hobby C programmer, not a pro.
Later, we created a much larger file, that ran in 3.2 seconds in C. This was the next bit of dialog:
Originally Posted by AdakIn the end, MK27 and others, also found an algorithm improvement for his Python program. The C program, running in C#, still took 15 seconds, even after this improvement. That's 4.69 times as long as the C run-time.Originally Posted by Macha
You'll see this over and over again, if you hang around mixed language programming forums and newsgroups. People finding nice speed-ups to their program, when it's set up to run in C or C++. It's not a coincidence.
I have never heard of a program, that ran slower, after being changed over from an interpreted language, to C. It could happen for the reasons Gustaff stated (poor choice of an algorithm in C), but I've never heard of it, except from inexperienced C/C++ programmers.
C programmers learn more about algorithms, because we do "roll our own". After awhile, we learn to "roll", rather better than you would expect.
I believe you'd be hard pressed to find time-critical programs, that haven't been switched over to run in a compiled language - especially C or C++, as soon as possible.