Hacker News new | ask | show | jobs
by pron 4077 days ago
> In theory you can do that in Java too using sun.misc.Unsafe but nobody actually does.

You wouldn't believe how many libraries use sun.misc.Unsafe, which is why it is being considered as a public API in Java 9 (this is necessary because access to it will be restricted by the new module system). It's used by people building their own concurrency primitives (it offers direct access to memory fences), as well as by people doing low-latency, low-garbage processing (very common in the UK financial trading industry).

> .NET can do ahead of time compilation when an app is installed, whereas HotSpot cannot

Right, but all realtime JVMs offer AOT compilation (it's the usual tradeoff: slower code but more predictable), and even HotSpot may offer either AOT (less likely) or JIT caching (more likely) in Java 9.