-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When you write an `fmt::Display`able type into a `fmt::Write` sink, a `fmt::Formatter` is used to facilitate the writing. It stores a `&dyn fmt::Write` reference to the sink, so less duplicated byte code is generated, but any possible optimizations before void. This PR lets rinja try to avoid using the normal `write!()` machinery. Indeed, not `write!()` call is made directly anymore in the generated code, but only though a `WriteWritable` helper trait. This aids the runtime performance quite a bit: ```text $ cd testing/benches $ cargo bench --bench all Big table time: [405.60 µs 406.46 µs 407.33 µs] change: [-12.463% -12.239% -12.022%] (p = 0.00 < 0.05) Performance has improved. Teams time: [200.00 ns 200.30 ns 200.61 ns] change: [-51.953% -51.462% -51.036%] (p = 0.00 < 0.05) Performance has improved. ```
- Loading branch information
Showing
6 changed files
with
295 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.