RFR: 8368465: [leyden] Improve precompiler method selection code
Aleksey Shipilev
shade at openjdk.org
Tue Sep 23 12:40:00 UTC 2025
On Tue, 23 Sep 2025 12:33: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 avoids a fairly awkward path to get compile IDs, ditching which _I suspect_ is the cause for performance improvement. With new code, we compile a tad more A2 code. I have not digged through why current code accepts fewer methods for compilation. New code improves performance everywhere, so I suggest we just accept that and move on.
>
> Additional testing:
> - [x] Performance tests (see comments)
> - [x] Linux x86_64 server fastdebug, `runtime/cds`
javac test (1000 iterations trained, 50 iterations production)
# --- Before
Benchmark 1: build/linux-x86_64-server-release/images/jdk/bin/java -Xms64m -Xmx1g -XX:+UseSerialGC -cp JavacBenchApp.jar -XX:AOTCache=app.aot JavacBenchApp 50
Time (mean ± σ): 350.4 ms ± 4.9 ms [User: 683.2 ms, System: 104.5 ms]
Range (min … max): 343.8 ms … 359.8 ms 10 runs
Benchmark 1: build/linux-x86_64-server-release/images/jdk/bin/java -Xms64m -Xmx1g -XX:+UseSerialGC -cp JavacBenchApp.jar -XX:+UnlockExperimentalVMOptions -XX:+PreloadOnly -XX:AOTCache=app.aot JavacBenchApp 50
Time (mean ± σ): 481.2 ms ± 3.4 ms [User: 475.0 ms, System: 55.8 ms]
Range (min … max): 477.0 ms … 487.9 ms 10 runs
# --- After
Benchmark 1: build/linux-x86_64-server-release/images/jdk/bin/java -Xms64m -Xmx1g -XX:+UseSerialGC -cp JavacBenchApp.jar -XX:AOTCache=app.aot JavacBenchApp 50
Time (mean ± σ): 344.0 ms ± 2.0 ms [User: 445.7 ms, System: 82.1 ms]
Range (min … max): 342.0 ms … 348.2 ms 10 runs
Benchmark 1: build/linux-x86_64-server-release/images/jdk/bin/java -Xms64m -Xmx1g -XX:+UseSerialGC -cp JavacBenchApp.jar -XX:+UnlockExperimentalVMOptions -XX:+PreloadOnly -XX:AOTCache=app.aot JavacBenchApp 50
Time (mean ± σ): 489.9 ms ± 1.7 ms [User: 481.2 ms, System: 58.6 ms]
Range (min … max): 487.2 ms … 492.8 ms 10 runs
`user` time significantly improves, I believe this is due to more `A2` code being used from the archive rather than being compiled on the fly.
Larger benchmarks all improve with 1-core tests.
quarkus-getting-started:
Run,Old CDS + AOT,New CDS + AOT
1,301,284
2,309,278
3,299,290
4,307,280
5,300,280
6,304,293
7,298,283
8,308,301
9,319,284
10,307,288
Geomean,305.14,286.02 (1.07x improvement)
Stdev,5.96,6.69
helidon-quickstart-se
Run,Old CDS + AOT,New CDS + AOT
1,200,197
2,228,199
3,211,198
4,218,200
5,214,201
6,221,200
7,214,207
8,220,200
9,211,197
10,222,199
Geomean,215.77,199.78 (1.08x improvement)
Stdev,7.34,2.71
micronaut-first-app
Run,Old CDS + AOT,New CDS + AOT
1,256,224
2,250,239
3,259,232
4,264,240
5,252,225
6,250,236
7,248,234
8,265,244
9,246,231
10,265,234
Geomean,255.41,233.82 (1.09x improvement)
Stdev,6.96,5.99
spring-boot-getting-started:
Run,Old CDS + AOT,New CDS + AOT
1,567,567
2,581,557
3,581,564
4,575,560
5,571,540
6,571,548
7,575,557
8,575,553
9,568,543
10,571,552
Geomean,573.48,554.04 (1.04x improvement)
Stdev,4.59,8.25
spring-petclinic:
Run,Old CDS + AOT,New CDS + AOT
1,3440,3384
2,3375,3391
3,3367,3379
4,3371,3375
5,3444,3378
6,3391,3399
7,3403,3371
8,3391,3378
9,3454,3391
10,3409,3374
Geomean,3404.37,3381.99 (1.01x improvement)
Stdev,30.09,8.54
-------------
PR Comment: https://git.openjdk.org/leyden/pull/99#issuecomment-3323828350
PR Comment: https://git.openjdk.org/leyden/pull/99#issuecomment-3323832493
More information about the leyden-dev
mailing list