Skip to content

docs: record hyperfine rust memory benchmark#318

Merged
vinitkumar merged 2 commits into
masterfrom
feat/rust-memory-save
Jun 10, 2026
Merged

docs: record hyperfine rust memory benchmark#318
vinitkumar merged 2 commits into
masterfrom
feat/rust-memory-save

Conversation

@vinitkumar

@vinitkumar vinitkumar commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Optimize Rust XML name handling and update documentation around invalid-name escaping and Rust memory benchmarks.

Enhancements:

  • Use borrowed/owned Cow strings in Rust XML name helper to reduce unnecessary allocations and support borrowed attributes.
  • Adjust Rust XML serialization call sites and tests to work with borrowed tag and attribute names while preserving single-escape behavior for invalid XML keys.

Documentation:

  • Clarify LAT test documentation for Rust invalid XML-name attribute escaping semantics.
  • Document that the June 2026 Rust memory benchmark is run under hyperfine in the architecture notes.

@sourcery-ai

sourcery-ai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Refactors Rust XML name handling to use borrowed/owned Cow strings to reduce allocations and fix double-escaping behavior, updates callers and tests accordingly, and documents the Rust memory benchmark’s use of hyperfine and the invalid-name-escaping contract in LAT docs.

File-Level Changes

Change Details Files
Refactor XML name normalization helper to use Cow for reduced allocations while preserving raw invalid-key behavior for later escaping.
  • Import std::borrow::Cow and change make_valid_xml_name to return Cow-based key and attribute-name/value types instead of owned Strings.
  • Ensure valid keys return borrowed Cows, numeric and space-rewritten keys allocate owned Cows, and invalid names fall back to borrowed "key" plus a borrowed raw-name attribute value.
  • Adjust consumers of make_valid_xml_name to work with Cow, including using as_ref()/into_owned() where needed for attribute construction and testing.
rust/src/lib.rs
Align XML writing helpers with new string ownership model and reduce unnecessary String cloning.
  • Change write_open_tag/write_close_tag and write_list_contents call sites to pass &String instead of moving Strings where appropriate.
  • Update dict/list serialization logic to derive name_attr as &str from Cow-based attribute pairs without extra allocations.
rust/src/lib.rs
Strengthen tests around invalid XML attribute name handling and escaping to guard against double-escaping with borrowed keys.
  • Update invalid-name tests to use the new Cow-based return types from make_valid_xml_name and compare via as_ref()/into_owned().
  • Annotate tests with a LAT link and add a new doc section specifying that invalid-name helpers must return raw keys for later escaping, preventing double-escape regressions.
rust/src/lib.rs
lat.md/tests.md
Clarify Rust memory benchmark documentation to record use of hyperfine for process-level measurements.
  • Update architecture documentation to state that the June 2026 Rust memory benchmark is run under hyperfine via benchmark_memory_rust.py.
  • Prepare or update the dedicated rust_memory_benchmark.rst doc to be consistent with the new benchmark description.
lat.md/architecture.md
docs/rust_memory_benchmark.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (43543e8) to head (e2be1b0).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #318   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          616       616           
=========================================
  Hits           616       616           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

cargo clippy --all-targets --all-features -- -D warnings
@vinitkumar vinitkumar merged commit 0355496 into master Jun 10, 2026
62 checks passed
@vinitkumar vinitkumar deleted the feat/rust-memory-save branch June 10, 2026 08:17
@vinitkumar vinitkumar restored the feat/rust-memory-save branch June 14, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant