Skip to content
Tech News
← Back to articles

Investigation finds G1GC card-marking barrier makes Arrays.fill 265x slower than ParallelGC

read original get Optimizing Java (O'Reilly) by Benjamin Evans → more articles
GoKawiil Brief

A JMH benchmark filling two reference arrays showed drastically different results depending on garbage collector: about 0.5ms on ParallelGC versus 139ms on G1GC, despite no garbage collection occurring during the measured operations. The author traces this gap through JIT compilation and JVM flags down to a specific machine instruction responsible for the slowdown.

Why It Matters

GoKawiil's interpretation of the reporting above, not reported fact.

This shows that GC choice can silently affect hot-path performance even when no collection is happening, through mechanisms like write barriers used for tracking cross-region references. Developers benchmarking or tuning JVM applications need to be aware that switching collectors can introduce order-of-magnitude regressions in seemingly unrelated code like array fills.

Key Takeaways
Worth a Look

Optimizing Java (O'Reilly) by Benjamin Evans — If digging into G1 vs ParallelGC write barriers and JIT behavior excites you, this O'Reilly book covers JVM internals, garbage collection tuning and benchmarking practice in depth. It's a great companion for anyone writing JMH benchmarks and puzzling over surprising performance numbers.

See Optimizing Java (O'Reilly) by Benjamin Evans on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.

Source: krzysztofslusarski.github.io, 2026-09-01

Published there as: “Why is Arrays.fill 265 times slower on G1GC?”

Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.