<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">from random import random<br>
<br>
try:<br>
 &nbsp; &nbsp;import clr<br>
 &nbsp; &nbsp;from System import DateTime<br>
<br>
 &nbsp; &nbsp;def timeit(func):<br>
 &nbsp; &nbsp; &nbsp; &nbsp;start = DateTime.Now<br>
 &nbsp; &nbsp; &nbsp; &nbsp;func()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;end = DateTime.Now<br>
 &nbsp; &nbsp; &nbsp; &nbsp;print func.__name__, &#39;took %s ms&#39; % (end - start).TotalMilliseconds</blockquote><div><br>Just a small nitpick or whatever, you might want to consider using the System.Diagnostics.StopWatch class as it &quot;Provides a set of methods and properties that you can use to accurately measure elapsed time.&quot;<br>
<br>i.e.<br><br>try:<br>&nbsp;&nbsp; import clr<br>&nbsp;&nbsp; from System.Diagnostics import StopWatch<br><br>&nbsp;&nbsp; def timeit(func):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; watch = StopWatch()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; watch.Start()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; func()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; watch.Stop()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print func.__name__, &#39;took %s ms&#39; % watch.Elapsed.TotalMilliseconds<br>
<br></div><div></div></div>