๐Ÿฆ€ I've improved the implementation behind all the string formatting macros in Rust: println!(), panic!(), format!(), write!(), log::info!(), and so on. (That is, everything based on format_args!().) They will compile a bit faster, use a bit less memory while compiling, result in smaller binaries, and produce more efficient code! ๐ŸŽ‰

'Hello world' compiles 3% faster and a few bigger projects like Ripgrep and Cargo compile 1.5% to 2% faster. And those binaries are roughly 2% smaller. ๐ŸŽŠ

This change will be available in Rust Nightly tomorrow, and should ship as part of Rust 1.93.0 in January.

The source of the standard Rust Hello World program with the generated assembly before and after the change.

The before version has 11 instructions and stores 56 bytes on the stack. The after version has 3 instructions and stores no data on the stack.
0
0
0

If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/Mara/statuses/115542621720999480 on your instance and quote it. (Note that quoting is not supported in Mastodon.)