RFR: 8368465: [leyden] Improve precompiler method selection code [v5]

Aleksey Shipilev shade at openjdk.org
Tue Dec 2 16:41:52 UTC 2025


On Tue, 2 Dec 2025 11:40:23 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Forked from [JDK-8366681](https://bugs.openjdk.org/browse/JDK-8366681): there are still some cleanups/performance improvements possible. Current selection code is a bit hairy, and turns out the changes I made for previous patch improve performance.
>> 
>> Notable improvements:
>>  1. Push the compilation level filters downwards. This allows compiling A2 from T2/T3 code more easily, and allows to implement policies for compiling on any A* level based on observing top-compiled T* levels.
>>  2. Sort methods by hotness and code size. This looks to have a positive effect on shorter workloads, I suspect because we are avoiding a lot of C1 compilations by preloading hottest code first.
>> 
>> Additional testing:
>>  - [x] Performance tests (see comments)
>>  - [x] Linux x86_64 server fastdebug, `runtime/cds`
>
> Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
> 
>  - Merge branch 'premain' into JDK-8368465-precompiler-method-select
>  - Drop the mention of MDO
>  - Merge branch 'premain' into JDK-8368465-precompiler-method-select
>  - Merge branch 'premain' into JDK-8368465-precompiler-method-select
>  - Touchup
>  - Touchups
>  - Fix

I re-merged with current `premain`, re-measured some light benchmarks, and the performance improvements are still there. I still believe this is a useful thing to do for infrastructural reasons (gives me access to more advanced selection policies), and performance boost comes as a nice bonus. There are other possibilities in optimizing interaction with preload code, and those can and should be done separately, IMO.


Benchmark 1: build/linux-x86_64-server-release/images/jdk/bin/java -XX:AOTCache=app.aot -Xms64m -Xmx1g -XX:+UseSerialGC -cp JavacBenchApp.jar JavacBenchApp 50 

### 2 cores

# Baseline
  Time (mean ± σ):     425.7 ms ±  17.6 ms    [User: 667.3 ms, System: 96.3 ms]
  Range (min … max):   404.8 ms … 458.1 ms    10 runs
 
  Time (mean ± σ):     427.5 ms ±  18.3 ms    [User: 668.7 ms, System: 99.6 ms]
  Range (min … max):   399.2 ms … 451.0 ms    10 runs

  Time (mean ± σ):     418.6 ms ±  11.6 ms    [User: 657.2 ms, System: 96.1 ms]
  Range (min … max):   402.5 ms … 436.7 ms    10 runs

# Patched
  Time (mean ± σ):     373.4 ms ±  11.7 ms    [User: 547.1 ms, System: 89.7 ms]
  Range (min … max):   359.3 ms … 397.5 ms    10 runs

  Time (mean ± σ):     363.4 ms ±   8.5 ms    [User: 511.6 ms, System: 92.6 ms]
  Range (min … max):   346.2 ms … 373.7 ms    10 runs

  Time (mean ± σ):     370.4 ms ±  11.9 ms    [User: 520.3 ms, System: 93.4 ms]
  Range (min … max):   353.4 ms … 384.3 ms    10 runs

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

PR Comment: https://git.openjdk.org/leyden/pull/99#issuecomment-3602972698


More information about the leyden-dev mailing list