News for hackers. Stuff that matters.
Re:Java 8: New features in ConcurrentHashMap by mike_hearn on Wednesday January 18, 2017 @04:04PM (#13430262)
The JVMs profile-guided optimisations are generally a 10-20% win for Java and more for Scala, I believe. They aren't that expensive to do. When you get into languages like Ruby or Python it just goes off the charts, you are getting orders of magnitude better performance from profile-guided JIT compilers.

As an example of what they can do, take de-virtualisation. Virtual method calls are expensive. Java method calls are virtual by default. The JVM profiles method calls and analyses the class hierarchy to discover which ones can be de-virtualised. That's a big win. C# requires programmers to manually specify which methods are virtual because .NET doesn't use profile-guided JIT compilation. In some cases (admittedly I've only seen artificial examples) this optimisation is so powerful you can write Java programs that completely trash C++ programs, e.g. a program that uses a command line switch to pick a subclass of a virtual base class and then runs method calls on that object in a tight loop. Java will devirtualise the call based on the observation that only one target is ever used, then inline it, then do loop opts on the inlined version.

Re:Java 8: New features in ConcurrentHashMap by ygra on Thursday January 19, 2017 @05:20PM (#13439993)
I'd say C# makes methods not virtual by default because it's a saner default. When writing a class you shouldn't make everything virtual, that should be a conscious decision to actually design a class for extensibility.