From a5943090495ea0e3fb3b67e95a3b796e21ac1918 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 31 Jan 2020 22:00:56 +0100 Subject: [PATCH] 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 --- lib/bup/compat.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 -- 2.39.2