From cd6cd16046daa993d8ebddaa0f195c8a9f16d585 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 17 May 2011 20:01:10 +0000 Subject: [PATCH] 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: https://github.com/neutrino-images/ni-neutrino/commit/9b04ffbb41f66bd0b98b6178b4e7b3695344af27 Author: Stefan Seyfried Date: 2011-05-17 (Tue, 17 May 2011) --- src/sectionsd/sectionsd.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sectionsd/sectionsd.cpp b/src/sectionsd/sectionsd.cpp index 2b94d8aa6..4682a2d3b 100644 --- a/src/sectionsd/sectionsd.cpp +++ b/src/sectionsd/sectionsd.cpp @@ -910,16 +910,16 @@ static void addEvent(const SIevent &evt, const unsigned table_id, const time_t z if (slow_addevent) { std::vector 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 */