Other than assembler for games, I have never chosen a language based on speed of execution. Anyone else?I once moved a major processing step from the database to C++. Execution time went from an estimated 1 week to a measured 5 minutes.
Why was the difference that big?
The fastest path to get a piece of data in the database is to do a binary search on an index that tells you what row in the table has your data, and what page of memory it is in. You then go to that page in memory, locate the row, parse it, and pull out the information of interest. All of this is controlled by instructions in some sort of microcode.
The equivalent data path is C++ was, "follow a pointer". Furthermore the C++ representation of the data was so much more compact that I was frequently managing to stay inside of CPU caches, versus the database approach where I was fighting to stay within RAM limitations.
Sometimes performance really, really does matter. (This is a rare circumstance.)
As for JavaScript, the reason that it beats everything else is that there is serious corporate muscle (eg Google and Apple) behind optimizing it as much as possible.