Skip to content

Commit

Permalink
[coq] [memo] Better parameters for polymorphic state hashing
Browse files Browse the repository at this point in the history
Default parameters where creating lots of collisions, producing chains
of hundredths of entries in the memo table.

The new settings seem optimal.
  • Loading branch information
ejgallego committed Jun 5, 2024
1 parent b598b8c commit 0a4fc39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- [fleche] Preserve view hint across document changes. With this
change, we get local continuous checking mode when the view-port
heuristic is enabled (@ejgallego, #748)
- [memo] More precise hashing for Coq states, this improves cache
performance quite a bit (@ejgallego, #749)

# coq-lsp 0.1.10: Hasta el 40 de Mayo _en effect_...
----------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion coq/state.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ let compare (x : t) (y : t) =
else 1

let equal x y = compare x y = 0
let hash x = Hashtbl.hash x
let hash x =
(* OCaml's defaults are 10, 100, but not so good for us, much
improved settings are below (best try so far) *)
let meaningful, total = 64, 256 in
Hashtbl.hash_param meaningful total x

let mode ~st =
Option.map
Expand Down

0 comments on commit 0a4fc39

Please sign in to comment.