[mythtv-commits] Ticket #3326: Implement multiple recordings per transport
MythTV
mythtv at cvs.mythtv.org
Tue Sep 18 03:30:35 UTC 2007
#3326: Implement multiple recordings per transport
---------------------+------------------------------------------------------
Reporter: danielk | Owner: danielk
Type: task | Status: new
Priority: minor | Milestone: unknown
Component: mythtv | Version: head
Severity: low | Resolution:
Mlocked: 0 |
---------------------+------------------------------------------------------
Comment(by danielk):
(In [14501]) Refs #3326. Small optimization for scheduling in multirec,
use deque instead of linked list for the RecList.
The reason a doubly linked list was used is because it has O(1)
performance for pop_front, pop_back, and erase, and O(n log n) performance
for sort. However, this datastructure is a memory hog and has a fairly
large constant in front of those (1)'s and (n log n)'s. By comparison a
deque has O(1) for pop_front, pop_back and O(n log n) for sorts and has a
very low memory footprint and runtime constant. erase is slow at O(n), but
we don't actually need fast erase's, by deferring our erases we get the
same O(n) total time for PruneOverlaps() and PruneRedundants() where n is
the number of items in the worklist.
I still use the same stable sort (merge sort) for the deque as was used
for the linked list.
In practice this is what a deque means for performance:
* With just 30 recording rules resulting in 622 scheduled recordings
there is no difference, the deque has a less than 1% advantage, which with
just 5 runs for each datastructure is meaningless.
* With 52 recording rules resulting in 1003 scheduled recording there is
a 12% speedup in placement, the deque has a definte advantage.
* With more recording rules resulting in more scheduled recordings the
advantage stays a little over 10%
Because the advantage is not as pronounced as the 4+ times faster code for
ProgramInfo::IsSameProgram() in [14500], I've left both implementations in
there for now, you can switch by changing USE_DEQUE_RECLIST in scheduler.h
from 1 to 0. This will make it easy to test different data against this
change and revert if necessary.
--This line, and those below, will be ignored--
M programs/mythbackend/scheduler.h
M programs/mythbackend/scheduler.cpp
M programs/mythbackend/httpstatus.cpp
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/3326#comment:87>
MythTV <http://svn.mythtv.org/trac>
MythTV
More information about the mythtv-commits
mailing list