Commit 61e8f6f
Pierre-Luc Tessier Gagne
perf(neovi): drop redundant int casts in NetworkID packing
Root cause:
`send()` converted expressions to `int(...)` even though bitwise operations on
Python ints already produce ints. The extra calls add tiny but unnecessary
overhead in a transmit hot path.
Implemented solution:
- Replace:
`int(network_id & 0xFF), int((network_id >> 8) & 0xFF)`
with:
`network_id & 0xFF, (network_id >> 8) & 0xFF`
Rationale vs alternatives:
This is a no-risk micro-optimization and cleanup with identical semantics.
Performance evidence:
- Evidence type: Python operation semantics and call-overhead analysis.
- Expected impact: Low but positive for high-frequency sends.
Test methodology:
- Session functional validation:
`python -m pytest test/test_neovi.py` -> passed.
Assumptions, limitations, risks:
- `network_id` remains integer-valued as enforced by existing channel parsing.
Potential follow-ups:
- Include send-heavy throughput profiling to quantify aggregate impact.
Other identified optimizations not implemented in this commit:
- Additional zero-copy opportunities require ICS API support.1 parent d7ca7d2 commit 61e8f6f
1 file changed
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
536 | | - | |
537 | | - | |
| 535 | + | |
538 | 536 | | |
539 | 537 | | |
540 | 538 | | |
| |||
0 commit comments