Hacker Newsnew | past | comments | ask | show | jobs | submit | TGR44's commentslogin

This...isn’t true.

Could you give any examples of common use cases and ways that people perform these “optimisations”?


Not necessarily common because garbage collected languages tend to not get used for high performance tasks, but a huge amount of modern optimization is in improving contiguous memory access and avoiding pointer chasing to use CPU cache more effectively, in java allocating arrays of primitives type is about the only way to do that. Similarly in c# they added spans to achieve this with better ergonomics, but both basically come down to avoiding the garbage collector for better performance.

Another big one is trying to allocate as much as possible on the stack, either through the language like c/c++/c# or by using local variables and hoping the compiler will do the right thing for you with java. A lot of the work gone into java vm's over the decades have been trying to improve this. Even java sacrifices it's OO purity to make integers and floats value types on the stack, that was to get non-laughable performance.

> This...isn’t true.

It's not even remotely controversial, saying garbage collection is slower is like saying water is wet.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: