]> arthur.barton.de Git - bup.git/commitdiff
compat: directly assign bytes_from_uint = chr
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 31 Jan 2020 21:00:56 +0000 (22:00 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 1 Mar 2020 22:54:23 +0000 (16:54 -0600)
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 <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/compat.py

index 859898d175425d0f363279098083f1e159a1c03e..f5819c281b220b7e6a3cfbc1edeb9e0c72134f2a 100644 (file)
@@ -134,8 +134,7 @@ else:  # Python 2
         """Return the original bytes passed to main() for an argv argument."""
         return x
 
         """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
 
     def bytes_from_byte(b):
         return b