Kernighan shared his thoughts on what he thinks of the world today — with its push away from C to more memory-safe programming languages, its hundreds of distributions of Linux — and with descendants of Unix powering nearly every cellphone.
In my limited experience the speed a rust complied executable runs is highly dependent on compiler options. By default (from what I remember), rust includes a ton of debug info in the resulting program. With the correct compiler flags you can strip all that out and programs run very close to c speeds.
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.
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
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…
Yeah, cargo build produces a debug build and cargo build --release is for actually distributing to users. (It doesn’t add the debug symbols, but also spends more time optimizing.)
In my limited experience the speed a rust complied executable runs is highly dependent on compiler options. By default (from what I remember), rust includes a ton of debug info in the resulting program. With the correct compiler flags you can strip all that out and programs run very close to c speeds.
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.
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.
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
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…
Yeah honestly this does smack of PEBKAC/RTFM
Yeah,
cargo build
produces a debug build andcargo build --release
is for actually distributing to users. (It doesn’t add the debug symbols, but also spends more time optimizing.)