perf: inline the hash accessor of Name (#12583)

This PR inlines the accessor for the computed hash field of `Name`. This
ensures that accessing the
value is basically always just a single load instead of doing a full
function call.
This commit is contained in:
Henrik Böving 2026-02-19 11:46:55 +01:00 committed by GitHub
parent ae15d787c1
commit 1f03e32520
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4685,7 +4685,7 @@ inductive Name where
with
/-- A hash function for names, which is stored inside the name itself as a
computed field. -/
@[computed_field] hash : Name → UInt64
@[computed_field, inline] hash : Name → UInt64
| .anonymous => .ofNatLT 1723 (of_decide_eq_true rfl)
| .str p s => mixHash p.hash s.hash
| .num p v => mixHash p.hash (dite (LT.lt v UInt64.size) (fun h => UInt64.ofNatLT v h) (fun _ => UInt64.ofNatLT 17 (of_decide_eq_true rfl)))