Java compilation [was GCs in the news]

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 22 03:55:20 PDT 2014


On Tuesday, 22 July 2014 at 08:10:31 UTC, Russel Winder via 
Digitalmars-d wrote:
> On Tue, 2014-07-22 at 06:35 +0000, Paulo Pinto via 
> Digitalmars-d wrote:
> […]
>> Yes it can, if developers bother to do PGO + AOT instead and 
>> learn the compiler flags.
>> 
>> I used to have a stronger opinion on JIT, but given how many 
>> JITs perform and do not actually use the hardware as they, in 
>> theory could, JIT tend to only be an advantage for dynamic 
>> languages not strong typed ones.
>> 
>> With JIT, writing the code in a way that makes the JIT 
>> compiler happy is a lost battle, as it depends on the exact 
>> same JIT implementation being available on the deployment 
>> system.
>
> I think you have to make good on this claim since the JVM JIT is
> intended for Java which is supposedly a static, strongly typed 
> language.

The JVM JIT was originally targeted to SELF, not Java.

> Moreover, evidence from Groovy is the JVM JIT provides only 
> patchy
> benefit. The biggest benefit all round is invokedynamic for 
> both static
> and dynamic languages. Java 8 would be nothing without 
> invokedynamic.


Functional programming languages have AOT compilers and they 
perform quite well, almost to C level in many use case cases.

As for Groovy, I always felt the implementation was always 
lacking in performance.

I avoid touching Gradle.

>
> But maybe we should take this off this list as it is way off 
> topic.
>
> Clearly we can use JMH for benchmarking. I have a couple of 
> codes I
> could use to try things out.
>
> So:
>
> 1. How to compile and execute to get full AOT *and* switch off 
> the JIT.
> 2. How to compile and execute to get no AOT and have JIT on 
> full.
>
> then we can begin to compare.

I was discussing JIT vs AOT in abstract.

To be able to perform such a tests you need:

- A programming language X
- The state of the art JIT compiler implementation for the given 
language
- The state of the art AOT compiler implementation for the given 
language

I know a few commercial AOT compilers for Java, not sure which 
one would be the best one to choose.


But the proof is Microsoft adding .NET Native to their toolchain, 
Google replacing Dalvik with AOT and Oracle has added AOT 
compilation (Substract) to Graal, the candidate to Hotspot 
replacement.

So apparently they all agree AOT still wins in many scenarios.

--
Paulo


More information about the Digitalmars-d mailing list