3 ms·
> Dynamic languages can be faster than C now, and are only improving. You're a bit too enthusiastic here, imo. JIT compiled code can in theory outperform AOT c
by cygx 15y ago
> Dynamic languages can be faster than C now, and are only improving.
You're a bit too enthusiastic here, imo. JIT compiled code can in theory outperform AOT compiled code because of dynamic recompilation of hot code paths. However, you can get some of the benefits of runtime code generation via profile-guided and link-time optimizations without any runtime overhead.
In practice, no dynamic language is faster than C (AOT compilation), and they rarely approach Java (AOT compilation to bytecode + JIT compilation to native code) where raw performance is concerned.
- artsrc 15y agoThat was my view yesterday. Then I benchmarked some JavaScript (CoffeeScript) code, and the same algo in C code and my world changed. I know that I could have optimized my C code better (I don't think I even turned optimization on), but I could have optimized my JavaScript better too.
- supersillyus 15y agoThat seems like a very small and somewhat flawed data point to be drawing any conclusions from.
- illumen 15y agoYes, for many workloads C/C++ is faster, and often lots faster. However, we are now close with dynamic languages for some workloads. Dynamically typed languages are doing AOT compilation and also starting to get very good type inference, such that code is getting similar to C++ speeds. See the 'shedskin' rpython to C++ compiler, and the latest firefox JavaScript type inference work. PyPy has shown faster than C speeds for certain workloads. Also, the luajit2 project has shown faster than C speeds for certain workloads. This comes from being able to do full program optimisations at runtime over module boundaries which is not possible in C/C++. C/C++ compilation is still much more advanced and faster in certain areas. Especially with auto vectorising, and a vast array of research and resources put into it that is far ahead of dynamic language developments. cheers,