• mitchty@lemmy.sdf.org
    link
    fedilink
    arrow-up
    17
    arrow-down
    1
    ·
    4 days ago

    The default for cargo is debug builds why that would surprise anyone as being slower is beyond me, —release isn’t that much extra to type or alias. Do people not learn how their tools work any longer? This isn’t that far off from c/c++ where you set cflags etc to fit the final binaries purpose.

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      3 days ago

      Tbf this mistake comes up so often I do wonder if cargo should have defaulted to release builds. It seems to be what beginners expect.

      • nrab@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        4
        ·
        3 days ago

        Gcc, clang, msvc, and all the other compilers also don’t optimize by default. It’s very normal and very expected for the default build to not include optimizations

        • FizzyOrange@programming.dev
          link
          fedilink
          arrow-up
          1
          arrow-down
          1
          ·
          2 days ago

          Sure but you don’t normally run GCC or Clang directly; you make, and that normally does optimise. I think a closer example is CMake which doesn’t enable release mode by default.

          MSVC is usually run from Visual Studio which makes it obvious which mode is being used so the default doesn’t matter so much.

          As for “all the other compilers”, Go optimises by default. It does seem to be the exception though…