announce handler: extract_response_peers: optimize

This commit is contained in:
Joakim Frostegård 2020-04-05 16:37:35 +02:00
parent aa771f6a68
commit 3c411bdbf4
2 changed files with 4 additions and 4 deletions

View file

@ -2,11 +2,9 @@
* Configuration, cli * Configuration, cli
* Tests * Tests
* Benchmarks * Optimize extract_response_peers
* Pareto distribution parameters OK?
* Clean connections: `state.connections.shrink_to_fit()`? * Clean connections: `state.connections.shrink_to_fit()`?
## Don't do ## Don't do
* Other hash algorithms: seemingly not worthwhile * Other hash algorithms: seemingly not worthwhile

View file

@ -177,8 +177,10 @@ pub fn extract_response_peers(
.collect() .collect()
} else { } else {
peer_map.values() peer_map.values()
.map(Peer::to_response_peer)
.choose_multiple(rng, number_of_peers_to_take) .choose_multiple(rng, number_of_peers_to_take)
.into_iter()
.map(Peer::to_response_peer)
.collect()
} }
} }