[mythtv] [Announce] Playback Optimization Patch (was: Playback

Chris Pinkham cpinkham at bc2va.org
Wed Jan 11 02:54:00 UTC 2006

> The frontend was doing a terribly slow regexp creation/search sequence
> in TV::GetQueuedChanNum that was soaking 14.6% of the process' CPU
> cycles.

>      bool HasQueuedChannel(void) const
> -        { return queuedChanID || !GetQueuedChanNum().isEmpty(); }
> +        { return queuedChanID || !queuedChanNum.isEmpty(); }

Would a more correct check without losing existing functionality
be something like this?

bool HasQueuedChannel(void) const
    { return queuedChanID || (!queuedChanNum.isEmpty() && !GetQueuedChanNum().isEmpty()); }

GetQueuedChanNum() strips off leading zeros, whitespace, etc..  Your patch
would return true if the QString was non-empty which doesn't maintain
existing functionality.  With the above mod, we only do the expensive
QRegExp/find code if the QString actually has something in it to check against.

Can you try this and see where it lies in the middle.  I assume during most cases
where there is no queued input that it will be just as fast as yours, but will
be more accurate in cases where there is queued input.


More information about the mythtv-dev mailing list