stickz / rtorrent

Stable high performance BitTorrent client
57 stars 3 forks source link

libtorrent: Optimize chunk selection based on priority #16

Closed stickz closed 4 months ago

stickz commented 4 months ago

This pull request optimizes the chunk selector search algorithm. It allows only searching the bitfield for the piece priority type we're looking for. Support is added to the download delegator to support this optimized search algorithm. The download delegator is also optimized to avoid searching the bitfield for normal priority pieces, when high priority pieces are found.

The result is a reduction in CPU usage when downloading torrents and an increase in the maximum download speed ceiling. Furthermore, high priority files are also downloaded quicker, with less normal priority pieces in the download queue.