From: Johannes Berg Date: Fri, 31 Jan 2020 21:00:56 +0000 (+0100) Subject: compat: directly assign bytes_from_uint = chr X-Git-Tag: 0.31~97 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=a5943090495ea0e3fb3b67e95a3b796e21ac1918 compat: directly assign bytes_from_uint = chr This is significantly faster than the indirection and seems to reduce the runtime of the test suite by about 3% on my machine with python 2 (76.121s -> 73.725s, but I tried only once which is clearly not enough.) Signed-off-by: Johannes Berg Reviewed-by: Rob Browning --- diff --git a/lib/bup/compat.py b/lib/bup/compat.py index 859898d..f5819c2 100644 --- a/lib/bup/compat.py +++ b/lib/bup/compat.py @@ -134,8 +134,7 @@ else: # Python 2 """Return the original bytes passed to main() for an argv argument.""" return x - def bytes_from_uint(i): - return chr(i) + bytes_from_uint = chr def bytes_from_byte(b): return b