• BB_C@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    Welcome.

    [profile.release]
    opt-level = 'z'     # Optimize for size
    

    It doesn’t matter here, let’s get that out of the way.

    But I’m wondering if someone/someplace is wrongly recommending this!

    Because lately I’ve been seeing this getting set in projects where their binaries wouldn’t be typically running on environments where this is required or even helpful.

    My concern is that some developers are setting this without really understanding what -Oz actually does.

    • TehPers@beehaw.org
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 months ago

      My understanding is that should almost only ever be set for WASM. Certain low-memory machines may also want it, but that’s extremely rare.

      I’m not sure who’s recommending it, only ever seen it recommended for WASM applications.

      • BB_C@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        2 months ago

        Certain low-memory machines may also want it

        This is a part of the misconceptions about it.

        It doesn’t meaningfully help with that unless much harder constraints are applied in development where it would become relevant at run-time. It can be relevant for low-storage machines however. That’s what binary size is primarily about after all. And low-storage and low-memory may go hand in hand at times as device properties.

        I’m not sure who’s recommending it

        See the link in my other comment.