#5199 closed Enhancement (fixed)
tr_sessionGetNextQueuedTorrent() can be faster
Reported by: | jordan | Owned by: | jordan |
---|---|---|---|
Priority: | Normal | Milestone: | 2.80 |
Component: | libtransmission | Version: | 2.75 |
Severity: | Normal | Keywords: | |
Cc: |
Description
tr_sessionGetNextQueuedTorrent() walks through all the torrents to get their queue positions. This is done in a loop, once per free queue slot.
This can be expensive if tr_sessionCountQueueFreeSlots() or tr_session.torrentCount are high. It would be better if the get-next func returned N torrents to avoid redundant walking and position calculations.
Attachments (1)
Change History (7)
comment:1 Changed 9 years ago by jordan
- Status changed from new to assigned
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 jordan
Changed 9 years ago by JJTagy
comment:4 follow-up: ↓ 6 Changed 9 years ago by JJTagy
May also want to change header file (attached)
comment:5 Changed 9 years ago by jordan
Looks like this knocked ~7% off the runtime in my tests. My test session had a large number of torrents, so in the average case the improvement would probably be smaller.
Before the change:
8.71% transmission-da transmission-daemon [.] tr_torrentNext | --- tr_torrentNext | |--91.32%-- tr_sessionGetNextQueuedTorrent | queuePulse | bandwidthPulse | event_base_loop |
And after:
1.42% transmission-da transmission-daemon [.] tr_torrentNext | --- tr_torrentNext | |--88.30%-- tr_sessionGetNextQueuedTorrents | queuePulse | bandwidthPulse | event_base_loop
comment:6 in reply to: ↑ 4 Changed 9 years ago by x190
Note: See
TracTickets for help on using
tickets.
Added in r13708, r13709