In multiple locations, we often use format! instead of write!.
The former consumes a lot of resources since we're constantly creating new strings, whereas the writer writes to some writable directly.
Not sure if this will make a major difference performance wise (like, a speedup of a few ms is not groundbreaking), but still more elegant.
It's what Clippy keeps pointing out as well.
Description of potential implementation
Use write! where possible (and where it doesn't create a lot of extra code noise) and pass a writeable as argument, or create it locally.
This is somewhat similar to using a StringBuilder in Java (it's the only example I have handy at the moment).
Current Issue
In multiple locations, we often use
format!
instead ofwrite!
. The former consumes a lot of resources since we're constantly creating new strings, whereas the writer writes to some writable directly. Not sure if this will make a major difference performance wise (like, a speedup of a few ms is not groundbreaking), but still more elegant. It's what Clippy keeps pointing out as well.Description of potential implementation
Use
write!
where possible (and where it doesn't create a lot of extra code noise) and pass a writeable as argument, or create it locally. This is somewhat similar to using a StringBuilder in Java (it's the only example I have handy at the moment).