From dddccc9bdead29800b8856537448cb28a395ba0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Wed, 15 Apr 1998 18:10:40 -0700 Subject: [PATCH] condition cache implemented, should speed up testing a few percent Rev: bin/test_pike.pike:1.12 --- bin/test_pike.pike | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/test_pike.pike b/bin/test_pike.pike index 4bf2986f52..1cf9a9560f 100755 --- a/bin/test_pike.pike +++ b/bin/test_pike.pike @@ -1,6 +1,6 @@ #!/usr/local/bin/pike -/* $Id: test_pike.pike,v 1.11 1998/04/11 11:53:35 grubba Exp $ */ +/* $Id: test_pike.pike,v 1.12 1998/04/16 01:10:40 hubbe Exp $ */ #include <simulate.h> @@ -13,6 +13,9 @@ int foo(string opt) if(opt=="" || !opt) return 1; return (int)opt; } + +mapping(string:int) cond_cache=([]); + int main(int argc, string *argv) { int e, verbose, successes, errors, t, check; @@ -96,7 +99,15 @@ int main(int argc, string *argv) test=tests[e]; if(sscanf(test,"COND %s\n%s",condition,test)==2) { - if(!clone(compile_string("mixed c() { return "+condition+"; }","Cond "+(e+1)))->c()) + int tmp; + if(!(tmp=cond_cache[condition])) + { + tmp=!!(clone(compile_string("mixed c() { return "+condition+"; }","Cond "+(e+1)))->c()); + if(!tmp) tmp=-1; + cond_cache[condition]=tmp; + } + + if(tmp==-1) { if(verbose) werror("Not doing test "+(e+1)+"\n"); -- GitLab