Skip to content

Reuse the traversal path’s rule name in the digest cache - #583

Merged
tinder-maxwellelliott merged 1 commit into
Tinder:masterfrom
tamird:tamird/reuse-rule-path-key
Oct 28, 2026
Merged

tinder-maxwellelliott merged 1 commit into
Tinder:masterfrom
tamird:tamird/reuse-rule-path-key

Conversation

@tamird

@tamird tamird commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

On its first visit to a rule, rule_digest clones the canonical name twice. The recursion path already owns the cache key when that visit finishes. Borrow the node’s name for comparisons and move the popped String into the completed-digest cache. This removes one transient string clone per completed rule.

A native Bazel test ran the two release-mode binaries on the public 160,000-target fixture, which contains 68,000 rules. The complete hash and dependency-edge files matched in all four pairs. Both binaries also produced identical hashes, edges and warnings for a two-rule cycle in both input orders, and reported the same missing-generator error. Public fixture

On one Mac with eight hashing threads, every PR run took longer than its paired stock run, by 0.003–0.530 s. Median wall time was 1.692 s for v67.0.2 and 1.777 s for this change. All eight runs ranged from 1.674 to 2.204 s, a 0.530 s span. The larger within-binary span was 0.481 s. Median waited peak RSS was 288.24 and 289.82 MiB respectively, with a 51.61 MiB larger within-binary span. The process-level wall and RSS effects remain unresolved. The first pair ran before other discretionary local work was paused.

The Rust and CLI suites, format check and clippy check passed.

bazel build --config=release --lockfile_mode=error //:bazel-diff
bazel test --lockfile_mode=error --nocache_test_results \
  //:rust_tests //src:cli_tests //:rust_format_check //:rust_clippy_check

Codex for Tamir.

Move the owned canonical name from the completed traversal frame into the
cache. The rule node supplies the borrowed name used during traversal.
@tinder-maxwellelliott
tinder-maxwellelliott merged commit edb2d08 into Tinder:master Oct 28, 2026
21 checks passed
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.

2 participants