Closed BoboTiG closed 2 years ago
Nothing wrong, simply trying to improve performances here, and there.
I used that script to naively benchmark changes for the 2nd commit:
import re from timeit import timeit def original(value, regex=re.compile("(0x)?[0-9a-f]*", re.IGNORECASE | re.ASCII)): return regex.fullmatch(value) is not None def new(value, regex=re.compile("(0[xX])?[0-9a-fA-F]*")): return regex.fullmatch(value) is not None print("original(True)", timeit( "original('0x5831e66b7de5df2d8d4705c86c844ff60a50efcec53f9449b16dc43216a783f7')", "from __main__ import original")) print("new(True)", timeit( "new('0x5831e66b7de5df2d8d4705c86c844ff60a50efcec53f9449b16dc43216a783f7')", "from __main__ import new")) print() print("original(False)", timeit( "original('0x5831e66b7de5df2d8d4705c86c844ff60a50efcec53f9449b16dc43216a783f7g')", "from __main__ import original")) print("new(False)", timeit( "new('0x5831e66b7de5df2d8d4705c86c844ff60a50efcec53f9449b16dc43216a783f7g')", "from __main__ import new"))
Improvements unlocked by the first commit:
When value has 0x prefix:
value
When value has 0X prefix:
When value has no 0x prefix:
Improvements unlocked by the 2nd commit:
When value is hexadecimal string (TX hash):
When value is not hexadecimal string (TX hash + 'g'):
[x] Clean up commit history
[x] Add entry to the release notes
I wasn't sure it deserved a news fragment. Here it is!
Thanks for the contribution!
What was wrong?
Nothing wrong, simply trying to improve performances here, and there.
How was it fixed?
I used that script to naively benchmark changes for the 2nd commit:
Improvements unlocked by the first commit:
When
value
has 0x prefix:When
value
has 0X prefix:When
value
has no 0x prefix:Improvements unlocked by the 2nd commit:
When
value
is hexadecimal string (TX hash):When
value
is not hexadecimal string (TX hash + 'g'):To-Do
[x] Clean up commit history
[x] Add entry to the release notes
Cute Animal Picture