Skip to content

perf: hash rule attributes from the query's encoding instead of decod… - #641

Open
maxwellE wants to merge 1 commit into
Tinder:masterfrom
maxwellE:perf/lean-attribute-decode
Open

maxwellE wants to merge 1 commit into
Tinder:masterfrom
maxwellE:perf/lean-attribute-decode

Conversation

@maxwellE

@maxwellE maxwellE commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

…ing them

generate-hashes decoded every attribute of every queried rule (Bazel prints implicit ones too, dozens per rule), hashed each one by re-encoding it, and then dropped all of them except tags and visibility. Decoding, re-encoding and freeing those attributes was most of bazel-diff's own CPU in the query phase.

The ordinary query path now walks each target's wire bytes, decodes the rule without the attributes only hashing reads, and hands those attributes to the prehash still encoded. The rule hash covers each attribute's message encoding, so hashing Bazel's bytes gives the same digest. Repository rules, cquery results, an isolated dependency root's strict query and anything the wire reader does not handle decode in full, as before.

@tinder-maxwellelliott
tinder-maxwellelliott marked this pull request as ready for review November 8, 2026 19:40
…ing them

generate-hashes decoded every attribute of every queried rule (Bazel prints
implicit ones too, dozens per rule), hashed each one by re-encoding it, and
then dropped all of them except tags and visibility. Decoding, re-encoding
and freeing those attributes was most of bazel-diff's own CPU in the query
phase.

The ordinary query path now walks each target's wire bytes, decodes the rule
without the attributes only hashing reads, and hands those attributes to the
prehash still encoded. The rule hash covers each attribute's message
encoding, so hashing Bazel's bytes gives the same digest. Repository rules,
cquery results, an isolated dependency root's strict query and anything the
wire reader does not handle decode in full, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJs3XzVMwWhwEiciBmHKk7

This branch has not been deployed

No deployments
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