Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#11053 closed Patch - Feature (fixed)

let EITScanner cache negative lookups

Reported by: dekarl@… Owned by: Karl Egly
Priority: minor Milestone: 0.27
Component: MythTV - EIT Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

inspired by Göran Uddeborg

http://lists.mythtv.org/pipermail/mythtv-dev/2012-August/072902.html

--- libs/libmythtv/eithelper.cpp.orig   2012-08-27 21:27:14.005909017 +0200
+++ libs/libmythtv/eithelper.cpp        2012-08-27 21:28:10.981876447 +0200
@@ -648,8 +648,7 @@
         return max(*it, 0);
 
     uint chanid = get_chan_id_from_db(sourceid, atsc_major, atsc_minor);
-    if (chanid)
-        srv_to_chanid[key] = chanid;
+    srv_to_chanid[key] = chanid;
 
     return chanid;
 }
@@ -667,8 +666,7 @@
         return max(*it, 0);
 
     uint chanid = get_chan_id_from_db(sourceid, serviceid, networkid, tsid);
-    if (chanid)
-        srv_to_chanid[key] = chanid;
+    srv_to_chanid[key] = chanid;
 
     return chanid;
 }

Negative hits are relevant for all channels that have either been deleted or useonairguide disabled though there is some transmitted guide. If a multiplex has no channel at all with useonairguide enabled the whole multiplex is skipped.

The patch is untested as of now as I'm running a modified version of the EITScanner at the moment.

Attachments (1)

mythtv_11053_cache_all_channel_id_results.patch (1.7 KB) - added by Rune Petersen <rune@…> 12 years ago.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by Rune Petersen <rune@…>

comment:1 Changed 12 years ago by Rune Petersen <rune@…>

great idea, I have improved your patch slightly for DVB, so fixup isn't calculated if channel lookup is negative.

It gives a slight measurable improvement in CPU usage for 'mythtvbackend' and a noticeable improvement in CPU usage when the EIT scanner is running in the background.

I am running this on a 700Mhz ARM system, so the improvement may be harder to notice on more powerful systems.

comment:2 Changed 12 years ago by Rune Petersen <rune@…>

Another thing, there is something strange with the EITHelper::GetChanID() functions.

1) The map 'srv_to_chanid' stores channel ID as a signed integer, but get_chan_id_from_db() returns channel ID an unsigned integer. Should the channel ID be signed or unsigned?

2) if the channel ID is in cache, the the channel ID is clamped to all positive numbers and 0 (return std::max(chanid, 0)), but if it isn't in the cache, the channel Id is just returned (return chanid)

comment:3 Changed 12 years ago by Karl Dietz <dekarl@…>

Resolution: fixed
Status: newclosed

In 374937ddb4657984c0eb2c0ff58d1c67ced20fb2/mythtv:

let EITScanner cache negative lookups and shortcut on hit

negative caching inspired by Göran Uddeborg's question on the dev list
http://lists.mythtv.org/pipermail/mythtv-dev/2012-August/072902.html

Rune Petersen added the shortcut to shave off some more wasted cycles.

Fixes: #11053

comment:4 Changed 12 years ago by Karl Egly

Milestone: unknown0.27
Owner: changed from Stuart Auchterlonie to Karl Egly
Note: See TracTickets for help on using tickets.