From 39b0ec5cf8900757bb19c13cb692b2414de91475 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Wed, 19 Oct 2011 15:36:14 -0700 Subject: Performance improvements in BVD --- Source/Model/Model.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'Source/Model') diff --git a/Source/Model/Model.cs b/Source/Model/Model.cs index f54ebbef..643a6b03 100644 --- a/Source/Model/Model.cs +++ b/Source/Model/Model.cs @@ -241,6 +241,31 @@ namespace Microsoft.Boogie /// public Element TryEval(params Element[] args) { + for (int i = 0; i < args.Length; ++i) + if(args[i]==null) + throw new ArgumentException(); + + if (apps.Count > 10) { + var best = apps; + for (int i = 0; i < args.Length; ++i) + if (args[i].references.Count < best.Count) + best = args[i].references; + if (best != apps) { + foreach (var tpl in best) { + bool same = true; + if (tpl.Func != this) + continue; + for (int i = 0; i < args.Length; ++i) + if (tpl.Args[i] != args[i]) { + same = false; + break; + } + if (same) return tpl.Result; + } + return null; + } + } + foreach (var tpl in apps) { bool same = true; for (int i = 0; i < args.Length; ++i) -- cgit v1.2.3