in reply to Re^2: Advice on learning Perl and graphics
in thread Advice on learning Perl and graphics

hippo you've caught me unprepared! ... so I can feel a future meditation brewing on this complex and interesting topic. :)

Static typing usually results in compiled code that executes faster. When the compiler knows the exact data types that are in use (which is necessary for static verification, either through declaration or inference) it can produce optimized machine code. Some dynamically-typed languages such as Common Lisp allow optional type declarations for optimization for this reason.

-- from Type system (wikipedia)

As indicated by the quote above, my performance assumption of the five listed (statically typed) languages (including Java) was based solely on the well-known general properties of static vs dynamic typing.

When I programmed in Java years ago, I remember the HotSpot technology muddying the performance waters when attempting to compare Java to C++ because (at least in theory) Java HotSpot could perform gradual dynamic performance optimizations at run-time (based on HotSpot profiling and the specific hardware it was running on) which C++ could not (update: nowadays it can, thanks to Chris Lattner's LLVM and Clang). Despite that, I've always loved C++ and disliked Java, and would always back C++ against Java in any specific benchmark shootout. :)

References Added Later

  • Comment on Re^3: Advice on learning Perl and graphics (Static vs Dynamic Typing and JIT References)