Open
Description
use std::fmt::Write;
let mut s = String::new();
write!(s, "{}", 1);
seemed to be generate more assembly compared to:
let mut s = String::new();
let v = format!("{}", 1);
s.push_str(&v);
For the above example, https://rust.godbolt.org/z/KPdra8
A larger example available at https://rust.godbolt.org/z/TcsbMK
Metadata
Metadata
Assignees
Labels
Area: `core::fmt`Category: An issue highlighting optimization opportunities or PRs implementing suchIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to performance of generated code.Relevant to the library team, which will review and decide on the PR/issue.