pion / turn

Pion TURN, an API for building TURN clients and servers
MIT License
1.87k stars 319 forks source link

Prevent heap allocations in FiveTuple Fingerprint #393

Closed paulwe closed 7 months ago

codecov[bot] commented 7 months ago

Codecov Report

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

Project coverage is 68.27%. Comparing base (8958518) to head (9616801).

Files Patch % Lines
internal/allocation/five_tuple.go 88.23% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #393 +/- ## ========================================== - Coverage 68.40% 68.27% -0.14% ========================================== Files 43 43 Lines 2333 2348 +15 ========================================== + Hits 1596 1603 +7 - Misses 573 578 +5 - Partials 164 167 +3 ``` | [Flag](https://app.codecov.io/gh/pion/turn/pull/393/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [go](https://app.codecov.io/gh/pion/turn/pull/393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | `68.27% <88.88%> (-0.14%)` | :arrow_down: | | [wasm](https://app.codecov.io/gh/pion/turn/pull/393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | `27.93% <72.22%> (+0.29%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

rg0now commented 7 months ago

We've already tried to track this down with @stv0g, see #299 and #304. This seems like a much better solution and the immediate effect is indeed massive performance improvement in GetAllocation based on my benchmarks (go test -cpuprofile cpu_895851.prof -bench=. -run=XXX -benchtime=200000x).

GetAllocation before the merge: UDPAddr.String dominates performance. profile_895851

GetAllocation after the merge: FiveTupeFingerprint got supercheap. profile_55407d