4 ms·
The 20% comes from personal experience, maybe I should have said 'close' but that can also mean anything. Basically this is an area where the hotspot heavy duty
by oelang 11y ago
The 20% comes from personal experience, maybe I should have said 'close' but that can also mean anything. Basically this is an area where the hotspot heavy duty compiler (C2) does the same optimizations as gcc or llvm. I would say that I would expect gcc & llvm to be within 20% of each other. The 20% is basically different tradeoffs made in the optimization pipeline (different peephole opts, different auto-vectorisation, register allocation algorithm, ...).
Java starts to seriously lags behind C++ when you need good control over the memory layout of your data. In java you can't have an array of objects, you get an array with references to objects. There are no elegant ways to solve that problem, the language just lacks the proper tools to do it elegantly. Memory layout is of course vital for cache efficiency, so that can give C & C++ a big advantage over java. Since this benchmarks uses arrays of doubles, this isn't an issue.
- nicolapede 11y agoI see your point now, thanks for the explanation. I mostly do scientific calculations, so effectively manipulations of array of doubles, and I currently mostly use C#. I was under the impression that the performance is similar to C++ (GPU aside), for that the comparison with Java had got my attention.
- cema 11y agoEven though C# is in many ways like Java, it allows (via unsafe blocks and pointers) to better perform memory management. Not sure how widely it is used in practice.