Re: [dev] Conversation with Anselm R. Garbe of suckless.org

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Wed, 16 Sep 2009 09:28:44 +0100

2009/9/16 Alan Busby <thebusby_AT_thebusby.com>:
>
> On Wed, Sep 16, 2009 at 4:42 PM, Anselm R Garbe
>>
>> IDE's like Eclipse have code assitance support to generate these
>> automatically, great isn't it? So if you imagine a Java program where
>> each datum access happens through getters and setters, the program
>> must become a magnitude faster  if the underlying code would be
>> replaced using direct datum/field access instead, wouldn't it?
>
> No, because even in C the compiler should be smart enough to do it for you.
> In Java, you can have even more convoluted code and the interpreter  can
> optimize it for you while it runs. GCC supports something similar as well
> with -fprofile-generate and -fprofile-use .

Of course there are various runtime optimisations presents in
nowaday's Java VMs and even compile time optimisations in AOT byte
code compilers, also wrt this aspect. However the downside of these
runtime optimisations has a cost: memory and duplicated data access
structures, that are believed to perform better. And if you imagine
that field access happens in 90% of all Java code through
optimised-away getter/setter calls, then this has surely an impact and
the thesis might still prove true. I'll definately add this to my
experiment project that does very weird stuff in Java, like very long
inheritance chains, classes with many thousand methods/fields etc. I
plan to do publish the experimentsat some point.

Kind regards,
Anselm
Received on Wed Sep 16 2009 - 08:28:44 UTC

This archive was generated by hypermail 2.2.0 : Wed Sep 16 2009 - 08:36:02 UTC