

Ask HN: How to compare different programming languages - indoindo

C++ is best for performance, in this case how to compare c++ to other languages in term of performance.
======
MichaelCrawford
Assembly code is best for performance but it is a huge pita.

~~~
indoindo
Of course, but how to determine languages that near ASM performance

~~~
MichaelCrawford
C, c++ and ask permit allocation on the stack. Many others require dynamic
allocation. Whether one language is faster depends on whether the problem at
hand can take advantage of stack allocation.

~~~
MichaelCrawford
Most modern computers have caches. On the whole they speed you up but some
access patterns lead caches to slow you down. Some instruction set
architectures have more registers than others.

So the fastest language also has to consider the hardware it is used on.

~~~
indoindo
Thank you very much! insightful comments!

~~~
MichaelCrawford
Some people just aren't very good coders. No language will make their programs
run faster. What will are books like effective c++, effective java and
refactoring.

The fastest language only makes sense when the code is written by an expert.

