to_bytes() adds significant overhead to keccak()
- Dominant language
- Python
- Stars
- 335
- Forks
- 167
- PR merge metrics
- No merged PRs in 30d
Description
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
```
Contributor guide
Assessment
This issue has not been assessed yet.