Repository navigation
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
Conversation
…e it between runs
… intrinsics, as HotSpot does
|
Warning Review limit reachedYou'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. View limit details
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. |
There was a problem hiding this comment.
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
What this changes
The PR checks take 8 to 10 minutes. The
testjob 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:SHA3.implCompress0andSHA3Parallel.doubleKeccak, the methods HotSpot intrinsifies. As bytecode, Keccak does all its work on BigInt longs.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.pnpm jdkkeepsbuild/jdkwhen the script, its Java helpers and the TLS provider sources are unchanged, and both workflows cache the image.Tests
pnpm jdktakes 0.04 s.Sha3Digestcovers SHA3-224/256/384/512 over inputs before, at and after a block edge, in pieces, and over many blocks.FloatBitscoversMath.absand the bit conversions in compiled loops. The JS Keccak also matches Node's SHA-3 on 21 inputs.pnpm typecheckpasses. The full unit suite passes: 291 passed, 0 failed.Noticed, not fixed
Float.intBitsToFloatandDouble.longBitsToDoublelose NaN payloads, because floats are JS numbers.Math.sindiffers from HotSpot in the last digits. Both are older than this change, andFloatBitsleaves them out.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.