Commit 5bb78bd4 authored by Guillaume Melquiond's avatar Guillaume Melquiond

Avoid pointless closures when hash-consing lists.

Best of three runs on a bench for Gappa transformations:
- before: 34.98user 0.09system 0:35.13elapsed 99%CPU (0avgtext+0avgdata 241492maxresident)k
- after:  29.68user 0.08system 0:29.80elapsed 99%CPU (0avgtext+0avgdata 241820maxresident)k
Speed-up: +18%.
parent a46145bb
......@@ -406,7 +406,7 @@ module Hsterm = Hashcons.Make (struct
let t_hash_quant (vl,b,tl,f) =
let h = bnd_hash b (t_hash f) in
let h = Hashcons.combine_list vs_hash h vl in
List.fold_left (Hashcons.combine_list t_hash) h tl
List.fold_left (fun acc t -> Hashcons.combine_list t_hash acc t) h tl
let t_hash_node = function
| Tvar v -> vs_hash v
......
......@@ -52,7 +52,7 @@ end
let combine acc n = n * 65599 + acc
let combine2 acc n1 n2 = combine acc (combine n1 n2)
let combine3 acc n1 n2 n3 = combine acc (combine n1 (combine n2 n3))
let combine_list f = List.fold_left (fun acc x -> combine acc (f x))
let combine_list f acc l = List.fold_left (fun acc x -> combine acc (f x)) acc l
let combine_option h = function None -> 0 | Some s -> (h s) + 1
let combine_pair h1 h2 (a1,a2) = combine (h1 a1) (h2 a2)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment