Mercurial > hg-stable
changeset 31434:63a39d647888
py3: make py3 compat.iterbytestr simpler and faster
With Python 3.4.3, timit says 11.9 usec-> 6.44 usec. With Python
3.6.0, timeit says 14.1 usec -> 9.55 usec.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 15 Mar 2017 09:32:18 -0700 |
parents | 4acc49335a6e |
children | 43a7dfbead0c |
files | mercurial/pycompat.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/pycompat.py Wed Mar 15 09:30:50 2017 -0700 +++ b/mercurial/pycompat.py Wed Mar 15 09:32:18 2017 -0700 @@ -78,7 +78,7 @@ def iterbytestr(s): """Iterate bytes as if it were a str object of Python 2""" - return iter(s[i:i + 1] for i in range(len(s))) + return map(bytechr, s) def sysstr(s): """Return a keyword str to be passed to Python functions such as