[Marble-commits] KDE/kdeedu/marble/src/lib

Thibaut Gridel tgridel at free.fr
Fri Nov 13 01:02:32 CET 2009


SVN commit 1048253 by tgridel:

Perfo issue while loading cityplacemark

The case is related to alphabetical sort in MarbleControlBox::m_sortproxy.
While adding the cityplacemark into the list it makes more sense
to do a reset. I didn't find the balance between simple and big case
(might be expressed as a ratio of length and size...) because the
gain is significant for now at startup.

 M  +10 -4     MarblePlacemarkModel.cpp  


--- trunk/KDE/kdeedu/marble/src/lib/MarblePlacemarkModel.cpp #1048252:1048253
@@ -157,12 +157,19 @@
 void MarblePlacemarkModel::addPlacemarks( int start,
                                           int length )
 {
+    Q_UNUSED(start);
+
+// performance wise a reset is far better when the provided list
+// is significant. That is an issue because we have
+// MarbleControlBox::m_sortproxy as a sorting customer.
+// I leave the balance search as an exercise to the reader...
+
     QTime t;
     t.start();
-    beginInsertRows( QModelIndex(), start, start + length );
+//    beginInsertRows( QModelIndex(), start, start + length );
     d->m_size += length;
-    endInsertRows();
-    emit layoutChanged();
+//    endInsertRows();
+    reset();
     qDebug() << "addPlacemarks: Time elapsed:" << t.elapsed() << "ms for" << length << "Placemarks.";
 }
 
@@ -175,7 +182,6 @@
     beginRemoveRows( QModelIndex(), start, start + length );
     d->m_size -= length;
     endRemoveRows();
-    emit layoutChanged();
     qDebug() << "removePlacemarks(" << containerName << "): Time elapsed:" << t.elapsed() << "ms for" << length << "Placemarks.";
 }
 


More information about the Marble-commits mailing list