You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #121001 - nyurik:optimize-core-fmt, r=<try>
perf: improve write_fmt to handle simple strings
Per `@dtolnay` suggestion in serde-rs/serde#2697 (comment) - attempt to speed up performance in the cases of a simple string format without arguments:
```rust
write!(f, "text") -> f.write_str("text")
```
```diff
+ #[inline]
pub fn write_fmt(&mut self, f: fmt::Arguments) -> fmt::Result {
+ if let Some(s) = f.as_str() {
+ self.buf.write_str(s)
+ } else {
write(self.buf, f)
+ }
}
```
Hopefully it will improve the simple case for the #99012
CC: `@m-ou-se` as probably the biggest expert in everything `format!`
0 commit comments