RFR: 8269823: JFR: Eliminate 'is_large' check for native JFR event if the size range is certain [v2]

Denghui Dong ddong at openjdk.java.net
Sun Jul 4 08:36:03 UTC 2021


On Sat, 3 Jul 2021 00:46:13 GMT, Denghui Dong <ddong at openjdk.org> wrote:

>> Hi,
>> 
>> Could I have a review of this improvement that eliminates 'is_large' check if the event size range is certain?
>> 
>> JDK-8246260 introduced event large checks to reduce the recording size.
>> This check could be eliminated at compile/build time when one of the following conditions is satisfied:
>> 1. if the max size is < 128
>> 2. if the min size is >= 128
>> 
>> The max size and the min size could be computed for the most native events at the generation phase.
>> 
>> And I think this improvement may also be done for JDK events.
>
> Denghui Dong has updated the pull request incrementally with one additional commit since the last revision:
> 
>   refactor

Hi Erik,

Thanks for the comments.

I only measure it on a marco benchmark that sends 100 same jfr native events which contain a uint field.

with this patch:
Benchmark                    Mode  Samples        Score  Score error  Units
o.s.MyBenchmark.testEmit    thrpt       20  8251457.275     2707.578  ops/s

without this patch:
Benchmark                    Mode  Samples        Score  Score error  Units
o.s.MyBenchmark.testEmit    thrpt       20  6608780.910     5604.914  ops/s

I agree with you that this optimization may not affect the overall performance of the application.

I think we can do further optimization based on this. For example, in the current implementation, we need to check whether there are enough buffers before writing each field of the event. If the available buffer is greater than the max size of an event, then we only need to check it once.

In addition, other current properties, such as hasThrottle, hasStackTrace, are pre-checked at compile time. Therefore, in my opinion, this optimization is necessary.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4670



More information about the build-dev mailing list