Tuesday, October 19, 2004

a simple Jython timing function

for any func i'd like to time in Java, I can use it with a call

print 'foo takes=',mytime(foo,[bar1,bar2,..barN])



# a higher order func
def mytime(f,args):
start=System.currentTimeMillis()
f(*args)
end=System.currentTimeMillis()

return end-start


No comments: