changeset 17558:380a89413403

wireproto: don't format a debug string inside a hot loop This improves stream_out performance by about 5%.
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 14 Sep 2012 12:06:40 -0700
parents 6d97dd630d79
children 83785bb56062
files mercurial/wireproto.py tests/test-check-code-hg.t
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireproto.py	Fri Sep 14 12:05:37 2012 -0700
+++ b/mercurial/wireproto.py	Fri Sep 14 12:06:40 2012 -0700
@@ -548,11 +548,13 @@
 
         sopener = repo.sopener
         oldaudit = sopener.mustaudit
+        debugflag = repo.ui.debugflag
         sopener.mustaudit = False
 
         try:
             for name, size in entries:
-                repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
+                if debugflag:
+                    repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
                 # partially encode name over the wire for backwards compat
                 yield '%s\0%d\n' % (store.encodedir(name), size)
                 if size <= 65536:
--- a/tests/test-check-code-hg.t	Fri Sep 14 12:05:37 2012 -0700
+++ b/tests/test-check-code-hg.t	Fri Sep 14 12:06:40 2012 -0700
@@ -6,7 +6,7 @@
   >     exit 80
   > fi
   $ hg manifest | xargs "$check_code" || echo 'FAILURE IS NOT AN OPTION!!!'
-  mercurial/wireproto.py:560:
+  mercurial/wireproto.py:562:
    >                     yield sopener(name).read(size)
    use opener.read() instead
   FAILURE IS NOT AN OPTION!!!