Testing long RCE
Radosław Smogura
mail at smogura.eu
Mon Dec 6 08:10:21 UTC 2021
Hi,
I'll check it for curiosity - I think debug mode does not have an impact on results.
Sometimes it can behave strangely - once I got worse results when commenting out the body of checkBounds() - I checked this a few times, as I could not believe - more code faster.
Kind regards,
Rado
________________________________
From: Maurizio Cimadamore <maurizio.cimadamore at oracle.com>
Sent: Sunday, December 5, 2021 12:49
To: Rado Smogura <mail at smogura.eu>; panama-dev at openjdk.java.net <panama-dev at openjdk.java.net>
Subject: Re: Testing long RCE
For the records the numbers I see in this branch are as follows:
```
Benchmark Mode Cnt Score Error Units
LoopOverNonConstant.segment_loop_int avgt 30 0.363 ? 0.001 ms/op
LoopOverNonConstant.segment_loop_long avgt 30 0.231 ? 0.003 ms/op
```
Which seem vaguely similar to what you got (but in your case it's odd,
because you seem to get worse results with a loop over a long variable -
but maybe there's some other issue in the patch you're using?).
Maurizio
On 05/12/2021 11:41, Maurizio Cimadamore wrote:
> Hi Rado,
> to achieve performance parity in existing benchmarks there's another
> piece we need:
>
> https://bugs.openjdk.java.net/browse/JDK-8276116
>
> Without that patch, the VM only optimizes if it detects a loop on a
> long variable (but all our benchmarks use an int variable).
>
> I suggest you use this branch (against jdk/jdk):
>
> https://github.com/mcimadamore/jdk/tree/long_loop_workarounds_removal
>
> Which contains full removal of existing workaround - I've been testing
> this with Roland over the last few months.
>
> Cheers
> Maurizio
>
> On 04/12/2021 18:49, Rado Smogura wrote:
>> Hi all,
>>
>> I tried to test long range checks 8259609 - as this is long awaiting
>> thing. I'm not sure if I do something wrong, but I can't get a good
>> results
>>
>>
>> Approach 1.
>> LoopOverNonConstant.segment_loop change int to long as counter
>>
>> AbstractMemorySegmentImpl.checkBounds I used followed code
>>
>> if (length < 0) {
>> throw outOfBoundException(offset, length);
>> }
>>
>> Objects.checkIndex(offset, this.length - (length - 1));
>>
>> Results were like Iteration 8: 0.376 ms/op
>>
>>
>> Approach 2
>>
>> AbstractMemorySegmentImpl.checkBounds use code like in 1, but without
>> segment_loop changes
>>
>> Iteration 8: 0.239 ms/op
>>
>> Approach 3 - original test
>> Iteration 8: 0.230 ms/op
>>
>> Sorry for not posting whole results (just grabbed partial results).
>> In graph as well I can see number of range checks in main loop :(
>>
>> Kind regards,
>> Rado
>>
More information about the panama-dev
mailing list