8000 binascii: ~40% speedup of unhexlify · micropython/micropython-lib@e1b24b8 · GitHub
[go: up one dir, main page]

Skip to content

Commit e1b24b8

Browse files
admin-slushPaul Sokolovsky
authored and
Paul Sokolovsky
committed
binascii: ~40% speedup of unhexlify
1 parent 6a7a9d2 commit e1b24b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

binascii/binascii.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def unhexlify(data):
44
if len(data) % 2 != 0:
55
raise Exception("Odd-length string")
66

7-
return b''.join([ int(data[i:i+2], 16).to_bytes(1) for i in range(0, len(data), 2) ])
7+
return bytes([ int(data[i:i+2], 16) for i in range(0, len(data), 2) ])
88

99
b2a_hex = hexlify
1010
a2b_hex = unhexlify

0 commit comments

Comments
 (0)
0