wireproto: don't audit local paths during stream_out
authorBryan O'Sullivan <bryano@fb.com>
Fri, 14 Sep 2012 12:05:12 -0700
changeset 17556 39c6e349dfff
parent 17555 57eba8158736
child 17557 6d97dd630d79
wireproto: don't audit local paths during stream_out Auditing at this stage is both pointless (paths are already trusted by the local repo) and expensive. Skipping the audits improves stream_out performance by about 15%.
mercurial/wireproto.py
--- a/mercurial/wireproto.py	Fri Sep 14 12:04:46 2012 -0700
+++ b/mercurial/wireproto.py	Fri Sep 14 12:05:12 2012 -0700
@@ -545,12 +545,20 @@
         repo.ui.debug('%d files, %d bytes to transfer\n' %
                       (len(entries), total_bytes))
         yield '%d %d\n' % (len(entries), total_bytes)
-        for name, size in entries:
-            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)
-            for chunk in util.filechunkiter(repo.sopener(name), limit=size):
-                yield chunk
+
+        sopener = repo.sopener
+        oldaudit = sopener.mustaudit
+        sopener.mustaudit = False
+
+        try:
+            for name, size in entries:
+                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)
+                for chunk in util.filechunkiter(sopener(name), limit=size):
+                    yield chunk
+        finally:
+            sopener.mustaudit = oldaudit
 
     return streamres(streamer(repo, entries, total_bytes))