Why is Arrays.fill 265 times slower on G1GC?

(krzysztofslusarski.github.io)

17 points | by ejboy 3 days ago

3 comments

  • hyperpape 1 hour ago
    I'm genuinely curious about the effect, but I simply don't have patience for the AI writing. Can anyone give an actual non-garbage explanation with some respect for the reader?

    Slightly less annoying summary from ChatGPT free: https://chatgpt.com/share/6a9ac7a3-15a0-83eb-8c2a-6f72cd9beb....

    Caveat emptor: it makes high level sense, but I haven’t thought about it in detail.

    • marcianx 33 minutes ago
      I'm genuinely curious: I read through the article and the narrative felt deliberate and didn't trigger my AI-radar. What made you think it was AI written?
      • anon48293 24 minutes ago
        It didn’t read AI generated to me. I also love the irony of then using AI to generate a summary
  • pron 18 minutes ago
    There are two practical lessons here:

    1. Upgrade your JDK for the best performance (as the article says, the slowdown is gone in JDK 26).

    2. Don't try to help the GC by pooling objects. Mutating old objects can be expensive, while allocating new ones is cheap (at least for objects that don't do some exceptionally expensive initialisation).