comparison data/model/EditableDenseThreeDimensionalModel.cpp @ 593:4f3e3fb07e0b

* Make expandAndRetrieve much faster for cases with duplicated data being compressed at the start of a column (as is common in e.g. adaptive spectrogram output)
author Chris Cannam
date Thu, 21 May 2009 16:54:43 +0000
parents 3cc4b7cd2aa5
children 1415e35881f6
comparison
equal deleted inserted replaced
592:18488253a3f4 593:4f3e3fb07e0b
298 if (top) { 298 if (top) {
299 for (int i = csize; i < psize; ++i) { 299 for (int i = csize; i < psize; ++i) {
300 c.push_back(p.at(i)); 300 c.push_back(p.at(i));
301 } 301 }
302 } else { 302 } else {
303 for (int i = psize - csize - 1; i >= 0; --i) { 303 // push_front is very slow on QVector -- but not enough to
304 c.push_front(p.at(i)); 304 // make it desirable to choose a different container, since
305 } 305 // QVector has all the other advantages for us. easier to
306 // write the whole array out to a new vector
307 Column cc(psize);
308 for (int i = 0; i < psize - csize; ++i) {
309 cc[i] = p.at(i);
310 }
311 for (int i = 0; i < csize; ++i) {
312 cc[i + (psize - csize)] = c.at(i);
313 }
314 return cc;
306 } 315 }
307 return c; 316 return c;
308 } 317 }
309 318
310 void 319 void
338 m_haveExtents = true; 347 m_haveExtents = true;
339 } 348 }
340 349
341 truncateAndStore(index, values); 350 truncateAndStore(index, values);
342 351
343 assert(values == expandAndRetrieve(index)); 352 // assert(values == expandAndRetrieve(index));
344 353
345 long windowStart = index; 354 long windowStart = index;
346 windowStart *= m_resolution; 355 windowStart *= m_resolution;
347 356
348 if (m_notifyOnAdd) { 357 if (m_notifyOnAdd) {