Mercurial > hg-stable
comparison mercurial/wireproto.py @ 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 | 2ee7281e5aaa |
comparison
equal
deleted
inserted
replaced
17557:6d97dd630d79 | 17558:380a89413403 |
---|---|
546 (len(entries), total_bytes)) | 546 (len(entries), total_bytes)) |
547 yield '%d %d\n' % (len(entries), total_bytes) | 547 yield '%d %d\n' % (len(entries), total_bytes) |
548 | 548 |
549 sopener = repo.sopener | 549 sopener = repo.sopener |
550 oldaudit = sopener.mustaudit | 550 oldaudit = sopener.mustaudit |
551 debugflag = repo.ui.debugflag | |
551 sopener.mustaudit = False | 552 sopener.mustaudit = False |
552 | 553 |
553 try: | 554 try: |
554 for name, size in entries: | 555 for name, size in entries: |
555 repo.ui.debug('sending %s (%d bytes)\n' % (name, size)) | 556 if debugflag: |
557 repo.ui.debug('sending %s (%d bytes)\n' % (name, size)) | |
556 # partially encode name over the wire for backwards compat | 558 # partially encode name over the wire for backwards compat |
557 yield '%s\0%d\n' % (store.encodedir(name), size) | 559 yield '%s\0%d\n' % (store.encodedir(name), size) |
558 if size <= 65536: | 560 if size <= 65536: |
559 yield sopener(name).read(size) | 561 yield sopener(name).read(size) |
560 else: | 562 else: |