BOO-986: Allow DefaultAttribute to work on parameters without an explicit type by...
[boo.git] / performance / delegate.boo
bloba1e727dadd301a4c362987072e218c95e3ac4443
1 def applyDelegate(delegate as System.Delegate, iterator):
2 for item in iterator:
3 delegate.DynamicInvoke((item,))
5 def applyCallable(fn as ICallable, iterator):
6 for item in iterator:
7 fn(item)
9 def timeit(name, fn as ICallable):
10 start = date.Now
11 fn(foo, range(5000000))
12 print("${name} took ${date.Now-start}")
14 def foo(item):
15 pass
17 timeit("Delegate.DynamicInvoke", applyDelegate)
18 timeit("ICallable.Call", applyCallable)