From: Albert G. <Dr....@t-...> - 2008-07-09 23:20:57
|
Libor Spacek wrote: > I have now expanded the "timex" function to take one string argument, being the function to be evaluated, with any number of arguments. Note that this includes compilation times which isn't very useful if you want to measure running times. Instead I'd suggest to work around this until macros are implemented by just creating a closure taking a dummy argument. > using system; > timex f = (clock-t0)/CLOCKS_PER_SEC, res when t0 = clock; res = f () end; > foo n = if n<=0 then n else foo (n-1); // burn some cycles > timex (\_->foo 100000); 0.14,0 > One problem remains, however. I noticed while testing it on some "queens" code that functions which use "throw .... catch" will segfault whenever put through the str...eval process. I just thought I would bring this to your attention, in case it is a bug. Do you have a minimal test case showing the bug? Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |