wireproto: don't format a debug string inside a hot loop
This improves stream_out performance by about 5%.
--- 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!!!