Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4690 closed Enhancement (fixed)

getPeerCandidates() uses more CPU than necessary

Reported by: jordan Owned by: jordan
Priority: Normal Milestone: 2.50
Component: libtransmission Version: 2.42
Severity: Normal Keywords:
Cc:

Description

Once we've scored all n candidates, we sort them by score so that we can pick out the k best candidates. If n is large, sorting them can be expensive.

If we use the Selection Algorithm, we select in O(n) without having to sort.

Change History (4)

comment:1 Changed 9 years ago by jordan

  • Status changed from new to assigned

Fixed in r13123.

comment:2 Changed 9 years ago by jordan

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:3 Changed 9 years ago by x190

Still, whether it's O(n) or O(n log n), if they're all controlled by vodo, T's still gonna crash by the time it hits tr_isPeerIo. Anyhow, glad to see you're working on the right stack (and still alive). :-)

comment:4 Changed 9 years ago by jordan

x190, that's a different ticket, but it's nice to see you :)

Note: See TracTickets for help on using tickets.