feat(toml)!: Replace toml_edit with toml_parse#945
Merged
epage merged 9 commits intotoml-rs:mainfrom Jun 12, 2025
Merged
Conversation
This changes out `Deserializer` and `ValueDeserializer` with ones built on `DeTable` and `DeValue`, rather than `toml_edit` This adds `IntoDeserializer` for both. BREAKING CHANGE: `ValueDeserializer::new` was replaced with `ValueDeserializer::parse` BREAKING CHANGE: `Deserialize::new` was replaced with `Deserializer::parse`
e438cca to
9af2239
Compare
Member
Author
|
Not controlling for jitter: $ cargo bench -Fpreserve_order --bench 0-cargo -- 2-features
0_cargo fastest │ slowest │ median │ mean │ samples │ iters
├─ serde_json │ │ │ │ │
│ ├─ document │ │ │ │ │
│ │ ╰─ 2-features 159 µs │ 275.1 µs │ 170.7 µs │ 175.1 µs │ 100 │ 100
│ ╰─ manifest │ │ │ │ │
│ ╰─ 2-features 169.8 µs │ 236.6 µs │ 188.1 µs │ 192.8 µs │ 100 │ 100
├─ toml_parse │ │ │ │ │
│ ├─ tokens │ │ │ │ │
│ │ ╰─ 2-features 83.09 µs │ 93.21 µs │ 84.86 µs │ 85.44 µs │ 100 │ 100
│ ├─ events │ │ │ │ │
│ │ ╰─ 2-features 116 µs │ 130.6 µs │ 121.1 µs │ 120 µs │ 100 │ 100
│ ╰─ decoded │ │ │ │ │
│ ╰─ 2-features 172.1 µs │ 236.1 µs │ 180.1 µs │ 180.8 µs │ 100 │ 100
├─ toml │ │ │ │ │
│ ├─ detable │ │ │ │ │
│ │ ╰─ 2-features 326.9 µs │ 621.7 µs │ 339.5 µs │ 343.8 µs │ 100 │ 100
│ ├─ detable_owned │ │ │ │ │
│ │ ╰─ 2-features 443.4 µs │ 513.9 µs │ 456.1 µs │ 457.9 µs │ 100 │ 100
│ ├─ document │ │ │ │ │
│ │ ╰─ 2-features 562.1 µs │ 633.6 µs │ 580.9 µs │ 582.9 µs │ 100 │ 100
│ ╰─ manifest │ │ │ │ │
│ ╰─ 2-features 465.1 µs │ 662.3 µs │ 546.1 µs │ 538.8 µs │ 100 │ 100
├─ toml_edit │ │ │ │ │
│ ├─ document │ │ │ │ │
│ │ ╰─ 2-features 622 µs │ 897.2 µs │ 694.6 µs │ 702.1 µs │ 100 │ 100
│ ╰─ manifest │ │ │ │ │
│ ╰─ 2-features 814.9 µs │ 910.2 µs │ 841.2 µs │ 845.4 µs │ 100 │ 100
╰─ toml_v05 │ │ │ │ │
├─ document │ │ │ │ │
│ ╰─ 2-features 943.4 µs │ 1.083 ms │ 990.7 µs │ 990.6 µs │ 100 │ 100
╰─ manifest │ │ │ │ │
╰─ 2-features 890.3 µs │ 1.499 ms │ 982.2 µs │ 995.7 µs │ 100 │ 100 |
joshtriplett
added a commit
to joshtriplett/toml
that referenced
this pull request
Jun 12, 2025
Also point people towards "unsafe" if they want maximum performance (per toml-rs#945 showing that the features together have better performance than "perf" alone).
Pull Request Test Coverage Report for Build 15617146449Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
This was referenced Jun 12, 2025
joshtriplett
added a commit
to joshtriplett/toml
that referenced
this pull request
Jun 13, 2025
Also point people towards "unsafe" if they want maximum performance (per toml-rs#945 showing that the features together have better performance than "perf" alone).
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
toml::de::DeTable,toml::de::DeValue,toml::de::DeString, andtoml::de::DeArraywhich are borrowed, spanned data structures for parsing into that we then support deserializing from. Due to the nature of TOML (aMaps keys are intermixed with descendant and parentMapkeys through dotted keys, standard table ordering, error reporting requirements), we can't directly deserialize from the parsed result.This also adds
IntoDeserializerforDeserializer/ValueDeserializer.BREAKING CHANGE:
ValueDeserializer::newwas replaced withValueDeserializer::parseand can return an error.BREAKING CHANGE:
Deserialize::newwas replaced withDeserializer::parseand can return an error.For the porting of
toml_edittotoml_parse, see #922For the introduction of
toml_parse, see #891Benchmarks
Notes:
mainis refactor(edit): Switch totoml_parse#922preserve_orderonly affectedtoml::Table, so the older "document" benchmarks fortomlwill parse into anIndexMap(fromtoml_edit) and then deserialize into either aBTreeMapor anIndexMapwhiledewill parse and deserialize into either aBTreeMapor anIndexMapmanifestdeserializes into astruct, avoiding at least a top-level*Mapcreation and avoid allocations of some keys.0_cargo::toml::document::2-features
preserve_ordermainmainpreserve_orderdedepreserve_orderdeunsafedesimdde0_cargo::toml::manifest::2-features
preserve_ordermainmainpreserve_orderdedepreserve_orderdeunsafedesimdde1_map::toml::document::100
preserve_ordermainmainpreserve_orderdedepreserve_orderdeunsafedesimdde1_map::toml::document::100
preserve_ordermainmainpreserve_orderdedepreserve_orderdeunsafedesimdde