RFR: 8267943: Improve performance of EventWriter by improving varint encoding implementation [v2]

Richard Startin github.com+16439049+richardstartin at openjdk.java.net
Fri Jun 4 14:51:01 UTC 2021


On Fri, 4 Jun 2021 11:56:16 GMT, Richard Startin <github.com+16439049+richardstartin at openjdk.org> wrote:

>> This PR improves the performance of committing events with numeric correlation ids by precomputing the number of continuation bytes required by each varint and storing them in a lookup table addressable by the input `long`'s leading zero count. In some rough [benchmarks](https://github.com/richardstartin/jfr-events/blob/master/src/main/java/io/github/richardstartin/jfrevents/CommitEventBenchmark.java), this shows a negligible regression for committing empty events, but a 15% improvement for committing an event with two random 64 bit identifiers.
>
> Richard Startin has updated the pull request incrementally with one additional commit since the last revision:
> 
>   shortcuts for small values

Hi Markus, I am committing this as a Datadog employee and believe I am covered by a company wide OCA.

We store trace and span identifiers which are uniformly distributed in [0, 2^63), so over 99.9% of these have the 8th byte set, so this represents a decent performance improvement for our use case, but obviously this shouldn't regress on core applications of this method, like stack traces and string fields. I am working on a benchmark with lots of `String` fields in the events so the majority of varints encoded are very short, to demonstrate this won't regress. It would be very helpful to run your internal benchmarks on this branch.

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

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


More information about the hotspot-jfr-dev mailing list