]> Sergey Matveev's repositories - btrtrc.git/commit
Avoid heap allocation in GetRequestablePieces (#734)
authorJonathan McDowell <noodles-github@earth.li>
Mon, 11 Apr 2022 04:22:05 +0000 (05:22 +0100)
committerGitHub <noreply@github.com>
Mon, 11 Apr 2022 04:22:05 +0000 (14:22 +1000)
commita1a820d3c98a7f2bdb5547ebede3b2f281e5e6e2
treedaaef5b7cc2726d57c16a51b82be9a2d254f7c0a
parentcba434999a446840a7749e7cd524803531b131e1
Avoid heap allocation in GetRequestablePieces (#734)

The calculation of whether we should ignore a piece in
GetRequestablePieces ends up doing an allocation for every piece, when
all we really need to do is query the index in the torrent. Provide an
IgnorePiece function instead, which avoids the need for a temporary
allocation.

Observed to cut out 40% of object allocations in some workloads (large
download, lots of seeds).
request-strategy-impls.go
request-strategy/order.go
request-strategy/torrent.go