Hacker News new | ask | show | jobs
by let_rec 24 days ago
On the other hand, the JVM spec may prohibit some optimizations you are after. It's very dynamic after all!
1 comments

Not really, that is the usual argument why CPython is slow.

If anything runtimes like the various JVM implementations, alongside the CLR and JS engines as well, are the bleeding edge of dynamic compiler optimizations with dynamic runtimes.

That is something that gets lost when talking about Java, yes the programming language looks like C++, however the JVM itself is heavily inspired by Smalltalk and Objective-C dynamic semantics.

Coming back to the spec, you will notice that it doesn't mention how threads are implemented, what kind of AOT/JIT are available, or what GC algorithms to implement, leaving enough room space for implementations.

One area where you are actually right, that I just remembered while typing this, are the way reflection or unsafe code hinders some optimizations, hence the ongoing steps that enabling JNI or FFM has to be explicit at startup, dynamic agents also have to be expliclity enabled, and the upcoming final means final (no more changing final fields via reflection).

what really matters is :

how far can i get in X programming language by writing just idiomatic code?

how much of SDK and community libs, frameworks help me run my program at bare metal speed ?

What sort of change i have to do exisitng libs, frameworks and my legacy code for CPU, IO and memory efficiency as a migrate to new version ?

That is only part of the picture, the other part that seems quite forgotten nowadays is:

- how much people actually care about algorithms and data structures

- do they actually know what options their tools have available

- have they ever spend at least an hour reading the man pages, info page or HTML documentations

- have they ever used a profiler, a graphical debugger, an advanced IDE