Skip to content

Instantly share code, notes, and snippets.

@hackaugusto
Created February 11, 2020 10:24
Show Gist options
  • Save hackaugusto/02bf9383accebdc928f48133e6faab06 to your computer and use it in GitHub Desktop.
Save hackaugusto/02bf9383accebdc928f48133e6faab06 to your computer and use it in GitHub Desktop.
import timeit
setup = "from eth_utils import keccak"
run = "keccak(b'')"
print("keccak")
print(timeit.timeit(run, setup))
setup = "from eth_utils import to_checksum_address"
run = f"to_checksum_address(b'00000000000000000000')"
print("to_checksum_address")
print(timeit.timeit(run, setup))
setup = "from eth_hash.auto import keccak"
run = "keccak(b'')"
print("keccak")
print(timeit.timeit(run, setup))
@konradkonrad
Copy link

note: the original spec was missing one transcoding -- but even with that, the non-eth_utils implementation is way faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment