Skip to content

to_bytes() adds significant overhead to keccak() #95

Description

@gsalgado

That function seems to add a big overhead to keccak(), and given its performance-critical nature I think we should consider dropping it (making keccak() accept only bytes). Here are some numbers showing the overhead it adds when compared to running the backend implementation directly:

$ python -m timeit -n 100000 -v -s "import os; from eth_hash.utils import auto_choose_backend; backend = auto_choose_backend()" "backend.keccak256(os.urandom(32))"
raw times: 1.81 1.82 1.85
100000 loops, best of 3: 18.1 usec per loop
$ python -m timeit -n 100000 -v -s "import os; from eth_utils import keccak" "keccak(os.urandom(32))"
raw times: 2.51 2.45 2.44
100000 loops, best of 3: 24.4 usec per loop

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions