comparison base/EventSeries.h @ 1618:ba3ddb7fe2bd single-point

Performance notes
author Chris Cannam
date Fri, 08 Mar 2019 11:54:35 +0000
parents bdc19a09a1f9
children f594fd249473
comparison
equal deleted inserted replaced
1617:bdc19a09a1f9 1618:ba3ddb7fe2bd
30 * series of "seams", which are frame positions at which the set of 30 * series of "seams", which are frame positions at which the set of
31 * simultaneous events changes (i.e. an event of non-zero duration 31 * simultaneous events changes (i.e. an event of non-zero duration
32 * starts or ends) associated with a set of the events that are active 32 * starts or ends) associated with a set of the events that are active
33 * at or from that position. These are updated when an event is added 33 * at or from that position. These are updated when an event is added
34 * or removed. 34 * or removed.
35 *
36 * Performance is highly dependent on the extent of overlapping events
37 * and the order in which events are added. Each event (with duration)
38 * that is added requires updating all the seams within the extent of
39 * that event, taking a number of ordered-set updates proportional to
40 * the number of events already existing within its extent. Add events
41 * in order of start frame if possible.
35 */ 42 */
36 class EventSeries 43 class EventSeries
37 { 44 {
38 public: 45 public:
39 EventSeries() : m_count(0) { } 46 EventSeries() : m_count(0) { }
346 } 353 }
347 } 354 }
348 355
349 #ifdef DEBUG_EVENT_SERIES 356 #ifdef DEBUG_EVENT_SERIES
350 void dumpEvents() const { 357 void dumpEvents() const {
351 std::cerr << "EVENTS [" << std::endl; 358 std::cerr << "EVENTS (" << m_events.size() << ") [" << std::endl;
352 for (const auto &i: m_events) { 359 for (const auto &i: m_events) {
353 std::cerr << i.first.toXmlString(" "); 360 std::cerr << " " << i.second << "x " << i.first.toXmlString();
354 } 361 }
355 std::cerr << "]" << std::endl; 362 std::cerr << "]" << std::endl;
356 } 363 }
357 364
358 void dumpSeams() const { 365 void dumpSeams() const {
359 std::cerr << "SEAMS [" << std::endl; 366 std::cerr << "SEAMS (" << m_seams.size() << ") [" << std::endl;
360 for (const auto &s: m_seams) { 367 for (const auto &s: m_seams) {
361 std::cerr << " " << s.first << " -> {" << std::endl; 368 std::cerr << " " << s.first << " -> {" << std::endl;
362 for (const auto &p: s.second) { 369 for (const auto &p: s.second) {
363 std::cerr << p.toXmlString(" "); 370 std::cerr << p.toXmlString(" ");
364 } 371 }