A fix could look something like this (this is just a prototype). This
changes sort time to 1.5s (from 59,5s). Ideally we would do that in apt
itself, having some more smartness there.

=== modified file 'common/rpackage.cc'
--- common/rpackage.cc  2010-01-25 10:17:45 +0000
+++ common/rpackage.cc  2010-02-17 10:30:48 +0000
@@ -744,6 +744,9 @@
 }
 
 #ifdef WITH_APT_AUTH
+std::map<pkgCache::PkgFileIterator, pkgIndexFile*> trust_cache;
+std::map<pkgCache::PkgFileIterator, pkgIndexFile*>::iterator it;
+
 bool RPackage::isTrusted()
 {
    pkgCache::VerIterator Ver;
@@ -757,17 +760,24 @@
    for (pkgCache::VerFileIterator i = Ver.FileList(); i.end() == false; i++)
    {
       pkgIndexFile *Index;
-      if (Sources->FindIndex(i.File(),Index) == false)
-         continue;
+      it = trust_cache.find(i.File());
+      if (it == trust_cache.end()) {
+        if (Sources->FindIndex(i.File(),Index) == false) 
+           continue;
+      } else {
+        Index = (*it).second;
+      }
+      trust_cache.insert( pair<pkgCache::PkgFileIterator, pkgIndexFile*>(i.File
(), Index) );
+           
       if (_config->FindB("Debug::pkgAcquire::Auth", false))
       {
          std::cerr << "Checking index: " << Index->Describe()
                    << "(Trusted=" << Index->IsTrusted() << ")\n";
       }
-      if (Index->IsTrusted())
+      if (Index->IsTrusted()) {
          return true;
+      }
    }
-   
    return false;
 }
 #else

-- 
Order by "Supported" Column Slow
https://bugs.launchpad.net/bugs/165181
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to