[mythtv-users] "watch recordings" menu -- 900 program limit?, and slow to generate

David Engel dlengel at attbi.com
Sat Dec 6 22:28:07 EST 2003


On Fri, Dec 05, 2003 at 01:35:10AM -0800, Eric Wemhoff wrote:
> Hi David.  I just got back from an extended thanksgiving trip here.
> Lots of recorded TV to catch up on.

With as many recordings as you have, I don't think you'll ever catch
up! :)

> Or are you talking about printing some console output before and after
> the call and using the stopwatch?  Okay that's easy for me to try ...

Yes, that's what I intended.

> and 15 seconds on
> 
>     for (int i = 0; i < numrecordings; i++)
>     {
>         ProgramInfo *pginfo = new ProgramInfo();
>         pginfo->FromStringList(strlist, offset);
>         info->push_back(pginfo);
> 
>         offset += NUMPROGRAMLINES;
>     }

Ah, the light bulb goes on!  From "man QValueList" regarding
operator[]:

    Warning: This function uses a linear search and can be extremely slow
    for large lists. QValueList is not optimized for random item access. If
    you need random access use a different container, such as QValueVector.

Switching to a QValueVector isn't really practical.  However, the
following patch should show some improvement.  Please note this is
against current CVS so you'll probably have to adapt it a little.  The
only tricky part is the double increment after the decodeLongLong.

If it shows sufficient improvement for you, I'll make a more complete
version for CVS that will be even faster.

David
-- 
David Engel
dlengel at attbi.com

Index: libs/libmythtv/programinfo.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/programinfo.cpp,v
retrieving revision 1.89
diff -u -r1.89 programinfo.cpp
--- libs/libmythtv/programinfo.cpp	6 Dec 2003 21:56:16 -0000	1.89
+++ libs/libmythtv/programinfo.cpp	7 Dec 2003 03:09:40 -0000
@@ -144,33 +144,36 @@
         return;
     }
 
-    title = list[offset];
-    subtitle = list[offset + 1];
-    description = list[offset + 2];
-    category = list[offset + 3];
-    chanid = list[offset + 4];
-    chanstr = list[offset + 5];
-    chansign = list[offset + 6];
-    channame = list[offset + 7];
-    pathname = list[offset + 8];
+    QStringList::iterator it = list.at(offset);
+
+    title = *(it++);
+    subtitle = *(it++);
+    description = *(it++);
+    category = *(it++);
+    chanid = *(it++);
+    chanstr = *(it++);
+    chansign = *(it++);
+    channame = *(it++);
+    pathname = *(it++);
     filesize = decodeLongLong(list, offset + 9);
-    startts = QDateTime::fromString(list[offset + 11], Qt::ISODate);
-    endts = QDateTime::fromString(list[offset + 12], Qt::ISODate);
-    conflicting = list[offset + 13].toInt();
-    recording = list[offset + 14].toInt();
-    override = list[offset + 15].toInt();
-    hostname = list[offset + 16];
-    sourceid = list[offset + 17].toInt();
-    cardid = list[offset + 18].toInt();
-    inputid = list[offset + 19].toInt();
-    recpriority = list[offset + 20];
-    norecord = NoRecordType(list[offset + 21].toInt());
-    recordid = list[offset + 22].toInt();
-    rectype = RecordingType(list[offset + 23].toInt());
-    recdups = RecordingDupsType(list[offset + 24].toInt());
-    recstartts = QDateTime::fromString(list[offset + 25], Qt::ISODate);
-    recendts = QDateTime::fromString(list[offset + 26], Qt::ISODate);
-    repeat = list[offset + 27].toInt();
+    it++; it++;
+    startts = QDateTime::fromString(*(it++), Qt::ISODate);
+    endts = QDateTime::fromString(*(it++), Qt::ISODate);
+    conflicting = (*(it++)).toInt();
+    recording = (*(it++)).toInt();
+    override = (*(it++)).toInt();
+    hostname = *(it++);
+    sourceid = (*(it++)).toInt();
+    cardid = (*(it++)).toInt();
+    inputid = (*(it++)).toInt();
+    recpriority = *(it++);
+    norecord = NoRecordType((*(it++)).toInt());
+    recordid = (*(it++)).toInt();
+    rectype = RecordingType((*(it++)).toInt());
+    recdups = RecordingDupsType((*(it++)).toInt());
+    recstartts = QDateTime::fromString(*(it++), Qt::ISODate);
+    recendts = QDateTime::fromString(*(it++), Qt::ISODate);
+    repeat = (*(it++)).toInt();
 
     if (title == " ")
         title = "";


More information about the mythtv-users mailing list