Commit Graph

25 Commits

Author SHA1 Message Date
Matt Joiner 1d2d1a9cde Store peer requests in a bitmap 2021-09-19 15:16:37 +10:00
Matt Joiner 21358ba458 Do peer requests separately for each peer 2021-09-18 20:34:14 +10:00
Matt Joiner cfb23e271f Export request_strategy.GetRequestablePieces 2021-09-18 18:57:50 +10:00
Matt Joiner c6fb0535d4 requesting: Remove some obsoleted condition checks
These shouldn't be necessary since peers were pruned for the ability to allocate chunks to the current piece.
2021-09-18 12:53:22 +10:00
Matt Joiner dd52a1440f request_strategy.Peer.canRequestPiece performance: Reorder conditions 2021-09-18 12:53:22 +10:00
Matt Joiner b757b62cf4 requesting: Filter peers that can't be allocated chunks 2021-09-16 10:47:27 +10:00
Matt Joiner a4697497aa Performance improvements in piece requesting 2021-09-16 00:12:24 +10:00
Matt Joiner 2b443d695b Change torrent capacity to not return a pointer
It's an unnecessary complication for a storage implementer.
2021-09-15 23:33:17 +10:00
YenForYang a8db640c62
Drop bradfitz/iter dependency (#605)
* Drop bradfitz/iter dependency

`range iter.N` looks nice and doesn't allocate, but unfortunately using a `range` expression blocks a function from being inlined wherever it's used (for now). It's not that we need inlining in all cases, but I do think a C-style for loop looks just as nice and is probably clearer to the majority. There also aren't any clear disadvantages to changing (unless you just happen to dislike the look of C)

* Update misc_test.go

* Update rlreader_test.go

* Update torrent_test.go

* Update bench_test.go

* Update client_test.go

* Update iplist_test.go

* Update mse_test.go

* Update peerconn_test.go

* Update peerconn.go

* Update order_test.go

* Update decoder_test.go

* Update main.go

* Update bench-piece-mark-complete.go

* Update main.go

* Update torrent.go

* Update iplist_test.go

* Update main.go
2021-09-14 13:46:50 +10:00
Matt Joiner 6c9a7fec39 Optimize peersForPieces allocations for make and sorting 2021-09-10 23:07:10 +10:00
Matt Joiner e9193968a3 Disable ensureValidSortedPeersForPieceRequests
Should approximately half the contribution of the parent function to overhead.
2021-09-10 23:07:10 +10:00
Matt Joiner 016bf1b07c Optimize sortPeersForPiece in allocatePendingChunks 2021-09-10 23:07:10 +10:00
Matt Joiner 7096da9f03 Minimize allocations and resizing in request computation 2021-08-01 22:02:40 +10:00
Matt Joiner f50b8fc2fa Fix issue with duplicate preallocated requests
Likely introduced by allowing actual and next request states to differ.
2021-06-07 13:01:40 +10:00
Matt Joiner 1a27e14391 Don't always force piece reallocation
The balancing for unforced pieces may not be exactly what we want yet.
2021-06-07 13:01:39 +10:00
Matt Joiner ad298364aa Add client-level max unverified bytes 2021-06-07 13:01:39 +10:00
Matt Joiner 63b0e42731 Get max unverified bytes working 2021-06-07 13:01:39 +10:00
Matt Joiner 307d6d178f Prepare to implement max unverified bytes 2021-06-07 13:01:39 +10:00
Matt Joiner 8e9cb9f2be Do checks for preallocated requests too
Otherwise we reserve requests with the assumption that they can be assigned later, and they actually might not be.
2021-06-07 13:01:39 +10:00
Matt Joiner 9dd85e5bd2 Fix non-deterministic test 2021-06-07 13:01:39 +10:00
Matt Joiner b80e2b08b5 Get request rebalancing working optimally! 2021-06-07 13:01:39 +10:00
Matt Joiner 4e9f707aeb Move piece allocation to its own func 2021-06-07 13:01:39 +10:00
Matt Joiner 07ba6e9210 New tests and fixes for them
Not complete. There's still a request-stealing balancing issue, but it's functional for now.
2021-06-07 13:01:39 +10:00
Matt Joiner 26837ee73c Add a working request strategy test 2021-06-07 13:01:39 +10:00
Matt Joiner 0d4e566fc0 Extract request strategy stuff into a separate module 2021-06-07 13:01:39 +10:00