anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.51k stars 622 forks source link

GetRequestablePieces: remove runtime correctness check #902

Closed veshij closed 7 months ago

veshij commented 7 months ago

In profiles I collected correctness check https://github.com/anacrolix/torrent/blob/c73c99b372114204b3e62ab7fe7103b2477c7dee/request-strategy/order.go#L60-L66 takes up to 10% cpu time. Would it make sense to remove it from runtime and add a unit-test for that instead (if not already)?

Screenshot 2024-02-07 at 11 25 12 PM

additional discussion is in https://github.com/anacrolix/torrent/issues/897#issuecomment-1933596287

anacrolix commented 7 months ago

I tried this on top of https://github.com/anacrolix/torrent/issues/897#issuecomment-1935323620, and it knocked off another 10%. This can be merged independently of evaluating that other change. Thanks for the contribution!