Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: optimize Key.hash at DiscrTree for the .const constructor #6020

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Lean/Meta/DiscrTreeTypes.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ inductive Key where
deriving Inhabited, BEq, Repr

protected def Key.hash : Key → UInt64
| .const n a => mixHash 5237 $ mixHash (hash n) (hash a)
| .const n a => mixHash (hash n) (hash a)
| .fvar n a => mixHash 3541 $ mixHash (hash n) (hash a)
| .lit v => mixHash 1879 $ hash v
| .star => 7883
| .other => 2411
| .arrow => 17
| .proj s i a => mixHash (hash a) $ mixHash (hash s) (hash i)
| .proj s i a => mixHash 5237 $ mixHash (hash a) $ mixHash (hash s) (hash i)

instance : Hashable Key := ⟨Key.hash⟩

Expand Down
4 changes: 2 additions & 2 deletions src/Lean/Meta/LazyDiscrTree.lean
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ namespace Key

/-- Hash function -/
protected def hash : Key → UInt64
| .const n a => mixHash 5237 $ mixHash n.hash (hash a)
| .const n a => mixHash (hash n) (hash a)
| .fvar n a => mixHash 3541 $ mixHash (hash n) (hash a)
| .lit v => mixHash 1879 $ hash v
| .star => 7883
| .other => 2411
| .arrow => 17
| .proj s i a => mixHash (hash a) $ mixHash (hash s) (hash i)
| .proj s i a => mixHash 5237 $ mixHash (hash a) $ mixHash (hash s) (hash i)

instance : Hashable Key := ⟨Key.hash⟩

Expand Down
Loading