sectionsd: more optimization of addEvent() (thanks Gaucho316)

This saves an SIevent constructor by temporarily modifying the
already created event. Also slightly reduces code size.
Performance impact: ~6.5% when reading 25000 events from disk on
coolstream, almost not noticeable (< 1%) on tripledragon.
The idea came from Gaucho316.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1479 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Commit: 9b04ffbb41
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2011-05-17 (Tue, 17 May 2011)
This commit is contained in:
Stefan Seyfried
2011-05-17 20:01:10 +00:00
parent 9d2a6cb8f7
commit cd6cd16046

View File

@@ -910,16 +910,16 @@ static void addEvent(const SIevent &evt, const unsigned table_id, const time_t z
if (slow_addevent)
{
std::vector<event_id_t> to_delete;
unsigned short eventID = e->eventID;
event_id_t e_key = e->uniqueKey();
t_channel_id e_chid = e->get_channel_id();
time_t start_time = e->times.begin()->startzeit;
/* create an event that's surely behind the one to check in the sort order */
SIevent *fptr = new SIevent(evt);
fptr->eventID = 0xFFFF; /* lowest order sort criteria is eventID */
SIeventPtr f(fptr);
/* returns an iterator that's behind 'f' */
e->eventID = 0xFFFF; /* lowest order sort criteria is eventID */
/* returns an iterator that's behind 'e' */
MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator x =
mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.upper_bound(f);
mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.upper_bound(e);
e->eventID = eventID;
/* the first decrement of the iterator gives us an event that's a potential
* match *or* from a different channel, then no event for this channel is stored */