On Fri, Feb 10, 2017 at 1:06 PM, Simon Farnsworth <simon...@fb.com> wrote:

> # Parent  1f51b4658f21bbb797e922d155c1046eddccf91d
> mercurial: use timeit.default_timer for interval measurement
>
> In Python 2.6 and later, timeit.default_timer() provides the highest
> resolution timer for profiling and performance measurement, but without a
> specified epoch (on some platforms, epoch is Python start time).
>
> Switch interval measures from time.time() to timeit.default_timer() to
> exploit this.
>

There's a fair bit of unused code in timeit that is unnecessary to pull in,
and loading modules has a cost.

Here's a better version:

--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1203,8 +1203,10 @@ def checkwinfilename(path):

 if pycompat.osname == 'nt':
     checkosfilename = checkwinfilename
+    timer = time.clock
 else:
     checkosfilename = platform.checkosfilename
+    timer = time.time

 def makelock(info, pathname):
     try:
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to