Skip to content

Conversation

shipilev
Copy link
Member

@shipilev shipilev commented Sep 23, 2025

Forked from 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:

  • Performance tests (see comments)
  • Linux x86_64 server fastdebug, runtime/cds

Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed (1 review required, with at least 1 Committer)

Issue

  • JDK-8368465: [leyden] Improve precompiler method selection code (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/leyden.git pull/99/head:pull/99
$ git checkout pull/99

Update a local copy of the PR:
$ git checkout pull/99
$ git pull https://git.openjdk.org/leyden.git pull/99/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 99

View PR using the GUI difftool:
$ git pr show -t 99

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/leyden/pull/99.diff

Using Webrev

Link to Webrev Comment

@shipilev
Copy link
Member Author

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.

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 23, 2025

👋 Welcome back shade! A progress list of the required criteria for merging this PR into premain will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@shipilev
Copy link
Member Author

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

@openjdk
Copy link

openjdk bot commented Sep 23, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 23, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 23, 2025

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant