forked from toml-rs/toml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: Speed up compile times with nom
This is using a short-lived fork `nom` until we can get the changes upstreamed. Note that `combine` requires using `attempt` to backtrack while `nom` backtracks by default and requires `cut` to not backtrack. I find the straight functions much easier to understand what is happening and this allows us to intermix procedural with declarative logic (e.g. in string processing I skipped combinators to make it easier to not require an allocation). Regarding that allocation, we still do it but this opens the door for us to use `InternalString` for user values which might give us more of a performance boost (previously, the forced allocation made it a moot point to measure it). Running `cargo clean -p toml_edit && time cargo check`, I get 3s for building `toml_edit` with `combine` and 0.5s for `nom`. For runtime performance - Parsing `cargo init`s generated manifest took 4% less time - Parsing `cargo`s manifest took 2% less time - 10 tables took 37% less time - 100 tables took 41% less time - Array of 10 tables took 38% less time - Array of 100 tables took 40% less time This is with Rust 1.66 on a i9-12900H processor under WSL2 Fixes toml-rs#327
- Loading branch information
Showing
89 changed files
with
1,492 additions
and
1,400 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.