RFR: 8162955: Activate anonymous class loading for small sources
Hannes Wallnöfer
hannes.wallnoefer at oracle.com
Wed Aug 17 06:08:32 UTC 2016
We have the „auto“ setting with its size threshold as default exactly because it does affect runtime performance. With anonymous classes, some octane benchmarks are significantly slower. So the rationale behind the „auto“ setting is that we use anon classes for small scripts because 1) loading time matters more here and 2) these are often run-once.
This is where the „auto“ setting was introduced, shortly after support for anonymous classes:
https://bugs.openjdk.java.net/browse/JDK-8138882
Hannes
> Am 13.08.2016 um 20:23 schrieb Marcus Lagergren <marcus at lagergren.net>:
>
> Interesting
> +1
>
> Is it possible to make this a flag with default “on", and check in a microbenchmark that proves this?
>
> Does this affect runtime performance, i.e. program execution speed, in any way that you can measure?
>
> Regards
> Marcus
>
>> On 09 Aug 2016, at 12:10, Hannes Wallnöfer <hannes.wallnoefer at oracle.com> wrote:
>>
>> It’s pretty drastic, and has gotten more pronounced in recent JDK 9 builds. Running test programs from the issues linked in the Jira description there’s somewhere between 30% and 100% speedup from using anonymous classes.
>>
>> Note that the intention has always been to use anonymous classes for short scripts, we just didn’t realize many users compile one-liners using the Java API.
>>
>> Hannes
>>
>>
>>> Am 09.08.2016 um 11:24 schrieb Marcus Lagergren <marcus at lagergren.net>:
>>>
>>> Do you have any benchmark examples with better and worse results?
>>>
>>> Just curious
>>>
>>> /M
>>>
>>>> On 04 Aug 2016, at 13:48, Hannes Wallnöfer <hannes.wallnoefer at oracle.com> wrote:
>>>>
>>>> Please review 8162955: Activate anonymous class loading for small sources.
>>>>
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8162955
>>>> Webrev: http://cr.openjdk.java.net/~hannesw/8162955/webrev/
>>>>
>>>> The size threshold of 512 bytes I chose is arbitrary. It seems to fit all reported cases which consist of firing lots of one-liner scripts where quick loading is more important than optimization.
>>>>
>>>> Thanks,
>>>> Hannes
>>>
>>
>
More information about the nashorn-dev
mailing list