From: Claudio Sacerdoti Coen Date: Thu, 17 May 2012 11:26:24 +0000 (+0000) Subject: The lpo cache is now implemented as an hastbl for more performance X-Git-Tag: make_still_working~1721 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=14f5eda52d26967d1704605e6548fd9140450913;p=helm.git The lpo cache is now implemented as an hastbl for more performance improvement. Probably it would be better with an ad-hoc hash-function. --- diff --git a/matita/components/ng_paramodulation/orderings.ml b/matita/components/ng_paramodulation/orderings.ml index bf033ec66..d24a5742e 100644 --- a/matita/components/ng_paramodulation/orderings.ml +++ b/matita/components/ng_paramodulation/orderings.ml @@ -364,13 +364,13 @@ module LPO (B : Terms.Blob) = struct let compute_goal_weight = compute_goal_weight;; (*CSC: beware! Imperative cache! *) - let cache = ref [];; + let cache = Hashtbl.create 101 let rec lpo_le s t = eq_foterm s t || lpo_lt s t and lpo_lt s t = - try List.assoc (s,t) !cache + try Hashtbl.find cache (s,t) with Not_found -> let res = match s,t with @@ -406,7 +406,7 @@ module LPO (B : Terms.Blob) = struct | _ -> assert false end in - cache := ((s,t),res)::!cache; res + Hashtbl.add cache (s,t) res; res ;; let lpo s t = @@ -416,7 +416,7 @@ module LPO (B : Terms.Blob) = struct else if lpo_lt t s then XGT else XINCOMPARABLE in - cache := []; res + Hashtbl.clear cache; res ;;