vacp2p / nim-libp2p

libp2p implementation in Nim
https://vacp2p.github.io/nim-libp2p/docs/
MIT License
242 stars 52 forks source link

avoid triple lookup in `m.flushed` yamux table #1045

Closed etan-status closed 4 months ago

etan-status commented 4 months ago

Using notin and then [header.streamId] twice results in the table m.flushed to be searched three times. The code can be optimized to only a single lookup using tables.withValue.

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 82.77%. Comparing base (6c87348) to head (a6a5f3d).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1045/graphs/tree.svg?width=650&height=150&src=pr&token=UR5JRQ249W&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im)](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1045?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im) ```diff @@ Coverage Diff @@ ## unstable #1045 +/- ## ========================================= Coverage 82.77% 82.77% ========================================= Files 91 91 Lines 15604 15604 ========================================= Hits 12916 12916 Misses 2688 2688 ``` | [Files](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1045?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im) | Coverage Δ | | |---|---|---| | [libp2p/muxers/yamux/yamux.nim](https://app.codecov.io/gh/status-im/nim-libp2p/pull/1045?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=status-im#diff-bGlicDJwL211eGVycy95YW11eC95YW11eC5uaW0=) | `88.34% <81.81%> (ø)` | |