Commit 4065a2f
authored
perf: skip HexBytes allocation for int indexing (#257)
## Summary
Switch HexBytes32 int indexing to use bytes.__getitem__ while keeping
slice behavior on FasterHexBytes.
## Rationale
Avoids allocating FasterHexBytes on int indexing in a hot path without
changing results.
## Details
- Int keys now go through bytes.__getitem__; slices still return
FasterHexBytes.
- Added assertions for positive/negative int indexing parity with bytes.
- mypyc: evmspec/_new.cpython-313-x86_64-linux-gnu.so loaded during
tests.
## Testing
- ./.venv/bin/python -m pytest1 parent 29b107e commit 4065a2f
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
413 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
414 | 416 | | |
415 | 417 | | |
416 | 418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
0 commit comments