Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Mara
@Mara@hachyderm.io  路  activity timestamp 10 hours ago

馃 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.

#rustlang

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.
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.
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.
  • Copy link
  • Flag this post
  • Block
Mara
@Mara@hachyderm.io replied  路  activity timestamp 9 hours ago

Note that there are also lots of programs where this change makes very little difference. Many benchmarks show just 0.5% or 0.1% improvement, or simply zero difference.

The most extreme case is the `large-workspace` benchmark, which is a generated benchmark with hundreds of crates that each just have a few println!() statements. That one now compiles 38% faster and produces a 22% smaller binary.

  • Copy link
  • Flag this comment
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About 路 Code of conduct 路 Privacy 路 Users 路 Instances
Bonfire social 路 1.0.0 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login