Avoid reallocations for reading qualified names#68
Merged
kornelski merged 1 commit intokornelski:mainfrom Jan 23, 2026
Merged
Conversation
c4ab9c3 to
c7fe1f4
Compare
Author
|
Running https://github.com/drott/xml-rs/blob/parserBench/tests/streaming.rs#L235 on my machine this gives me a 2.8% improvement in runs per second on running this parsing benchmark that is similar to the one we use for Blink. The existing allocation in
is gone:
|
c7fe1f4 to
456c198
Compare
Author
|
Looks like there are still correctness issues, I'll look into that. |
456c198 to
57055e6
Compare
Qualified names accumulate into buf, but drop their scratch space after every completion of reading a qualified name. At the end of reading a qualified name, the scratch space only needs to be read by reference. The allocation of the value returned to the API client happens in OwnedName. By using a separate scratch space `qualified_name_buf`, we can operate on the same scratch space string for each time reading a qualified name. Results in a 2.8% speedup in a local measurement against a test similar to [1]. [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/perf_tests/parser/xml-parser.html;l=8?q=xml-parser.html
57055e6 to
031ec9c
Compare
Author
|
I believe this is ready for review now. |
kornelski
approved these changes
Jan 23, 2026
mohd-akram
pushed a commit
to gsource-mirror/chromium-src-third_party-rust
that referenced
this pull request
Feb 4, 2026
Changes merged in upstream but no version released yet. Covers kornelski/xml-rs#68 Bug: 470367156 Change-Id: I1e2b729c7e2e61aff25b6c84e75f298718061df2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7544561 Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org> Auto-Submit: Dominik Röttsches <drott@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/main@{#1579537} NOKEYCHECK=True GitOrigin-RevId: f41e0fc863c04deab1f3e4bb3be97251842b87cc
jenkins-chromium-github-sync bot
pushed a commit
to armarok/chromium
that referenced
this pull request
Feb 4, 2026
Changes merged in upstream but no version released yet. Covers kornelski/xml-rs#68 Bug: 470367156 Change-Id: I1e2b729c7e2e61aff25b6c84e75f298718061df2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7544561 Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org> Auto-Submit: Dominik Röttsches <drott@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/main@{#1579537}
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.


Qualified names accumulate into buf, but drop their scratch space after every completion of reading a qualified name. At the end of reading a qualified name, the scratch space only needs to be read by reference. The allocation of the value returned to the API client happens in OwnedName.
By using a separate scratch space
qualified_name_buf, we can operate on the same scratch space string for each time reading a qualified name.