[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kio/kio
From:       Michael Brade <brade () kde ! org>
Date:       2005-03-27 15:19:16
Message-ID: 20050327151916.434DE3E9 () office ! kde ! org
[Download RAW message or body]

CVS commit by brade: 

Optimizing for another 3-4% (0.15sec) more speed: it is not worth it to 
iterate twice over almost all entries in the UDSEntry just to find out that
in at most three cases we can abort the loop earlier.


  M +9 -20     kdirlister.cpp   1.196


--- kdelibs/kio/kio/kdirlister.cpp  #1.195:1.196
@@ -1498,15 +1498,12 @@ void KDirListerCache::slotUpdateResult( 
   for ( ; it != buf.end(); ++it )
   {
-    QString name;
+    // Form the complete url
+    if ( !item )
+      item = new KFileItem( *it, jobUrl, delayedMimeTypes, true );
+    else
+      item->setUDSEntry( *it, jobUrl, delayedMimeTypes, true );
 
     // Find out about the name
-    KIO::UDSEntry::Iterator it2 = (*it).begin();
-    for ( ; it2 != (*it).end(); it2++ )
-      if ( (*it2).m_uds == KIO::UDS_NAME )
-      {
-        name = (*it2).m_str;
-        break;
-      }
-
+    QString name = item->name();
     Q_ASSERT( !name.isEmpty() );
 
@@ -1522,5 +1519,6 @@ void KDirListerCache::slotUpdateResult( 
       if ( !dir->rootItem )
       {
-        dir->rootItem = new KFileItem( *it, jobUrl, delayedMimeTypes, true  );
+        dir->rootItem = item;
+        item = 0;
 
         for ( KDirLister *kdl = listers->first(); kdl; kdl = listers->next() )
@@ -1532,15 +1530,6 @@ void KDirListerCache::slotUpdateResult( 
     }
 
-    // Form the complete url
-    if ( !item )
-      item = new KFileItem( *it, jobUrl, delayedMimeTypes, true );
-    else
-      item->setUDSEntry( *it, jobUrl, delayedMimeTypes, true );
-
-    QString url = item->url().url();
-    //kdDebug(7004) << "slotUpdateResult : look for " << url << endl;
-
     // Find this item
-    if ( (tmp = fileItems[url]) )
+    if ( (tmp = fileItems[item->url().url()]) )
     {
       tmp->mark();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic