Skip to content

perf: cut the two slowest OpenJDK tests by a third with SHA-3 and Math.abs intrinsics, and halve the jdb test in CI - #139

Merged
Project516 merged 5 commits into
masterfrom
p516/speed-up-ci-ide-tests
Dec 4, 2026
Merged

Project516 merged 5 commits into
masterfrom
p516/speed-up-ci-ide-tests

Conversation

@Project516

Copy link
Copy Markdown
Owner

What this changes

The PR checks take 8 to 10 minutes. The test job spends 82 s on one jdb test, and every OpenJDK shard waits on its slowest test, several of which run 10 to 60 times slower than on HotSpot. This makes the slowest steps faster without running fewer tests:

  • SHA-3 runs as intrinsics: SHA3.implCompress0 and SHA3Parallel.doubleKeccak, the methods HotSpot intrinsifies. As bytecode, Keccak does all its work on BigInt longs.
  • The JIT compiles Math.abs(double), Math.abs(float) and the raw double and float bit conversions to plain JS instead of a native call. Math.abs(double) was a round trip through the BigInt of the value's bits.
  • The jdb tests run the HotSpot and java-web sessions at the same time instead of one after the other.
  • pnpm jdk keeps build/jdk when the script, its Java helpers and the TLS provider sources are unchanged, and both workflows cache the image.

Tests

  • Master and branch alternated on the same CI runner, 2 runs each (seconds):
    • Integrate: 203, 199 on master; 135, 133 on the branch
    • TestSameLength: 190, 193 on master; 127, 123 on the branch
    • ResponsePublisher, SpecialHeadersTest, RandomCanaryPi and ThrowingPublishersInNextRequest are unchanged.
  • The jdb test takes 40 s instead of 82 s.
  • A second pnpm jdk takes 0.04 s.
  • New programs compared with HotSpot: Sha3Digest covers SHA3-224/256/384/512 over inputs before, at and after a block edge, in pieces, and over many blocks. FloatBits covers Math.abs and the bit conversions in compiled loops. The JS Keccak also matches Node's SHA-3 on 21 inputs.
  • pnpm typecheck passes. The full unit suite passes: 291 passed, 0 failed.

Noticed, not fixed

  • Float.intBitsToFloat and Double.longBitsToDouble lose NaN payloads, because floats are JS numbers. Math.sin differs from HotSpot in the last digits. Both are older than this change, and FloatBits leaves them out.
  • The HTTP client tests call System.gc() 500 to 800 times in a loop with 10 ms sleeps, and each collection takes about 75 ms. Letting other threads run between collections made those tests slower, so this PR does not change it.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: a72dfe2b-6e52-4bc0-97bd-0a2f7199f5f5
Commits

Reviewing files that changed from the base of the PR and between 3d290d0 and 5f44160.

Files selected for processing: 9

  • .github/workflows/jtreg.yml
  • .github/workflows/test.yml
  • scripts/build-jdk.sh
  • src/jit.ts
  • src/natives/crypto.ts
  • src/natives/misc.ts
  • test/java/FloatBits.java
  • test/java/Sha3Digest.java
  • test/jdwp.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@project516-review-bot project516-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR adds SHA-3 intrinsics, Math.abs and raw bit-conversion intrinsics, parallel jdb sessions, and a build-jdk input cache. I found one defect in the diff itself: the build-jdk.sh early-exit guard checks $out/lib/image.sha256 but the stamp is written to build/jdk.inputs at the end of the script, while the workflow caches build/jdk.inputs. On the first branch run after this PR merges, the restored stamp will not match because scripts/build-jdk.sh itself is part of the hash, so the script rebuilds correctly. However, if the image build fails after rm -f "$stamp" and before echo "$inputs" > "$stamp", the stamp is lost and every subsequent run rebuilds even when nothing changed. Also, build-jdk.sh does not set -e, so a failed module extraction or link can leave a partially built build/jdk with a stale or missing stamp, and the cache-restore-plus-skip path would then use a broken image. These are cache-integrity issues worth fixing before merge.


review-bot, model nvidia/nemotron-3.5-super-vl:free, verdict approve

Comment thread scripts/build-jdk.sh Resolved
@Project516
Project516 merged commit c4aafdb into master Dec 4, 2026
16 checks passed
@Project516
Project516 deleted the p516/speed-up-ci-ide-tests branch December 4, 2026 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant