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
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 pkgCache: :PkgFileIterato r, pkgIndexFile*> trust_cache; pkgCache: :PkgFileIterato r, pkgIndexFile* >::iterator it; :isTrusted( ) :VerIterator Ver; :VerFileIterato r i = Ver.FileList(); i.end() == false; i++) >FindIndex( i.File( ),Index) == false) find(i. File()) ; >FindIndex( i.File( ),Index) == false) :PkgFileIterato r, pkgIndexFile* >(i.File >FindB( "Debug: :pkgAcquire: :Auth", false))
< < "(Trusted=" << Index->IsTrusted() << ")\n"; >IsTrusted( )) >IsTrusted( )) {
+std::map<
+std::map<
+
bool RPackage:
{
pkgCache:
@@ -757,17 +760,24 @@
for (pkgCache:
{
pkgIndexFile *Index;
- if (Sources-
- continue;
+ it = trust_cache.
+ if (it == trust_cache.end()) {
+ if (Sources-
+ continue;
+ } else {
+ Index = (*it).second;
+ }
+ trust_cache.insert( pair<pkgCache:
(), Index) );
+
if (_config-
{
std::cerr << "Checking index: " << Index->Describe()
}
- if (Index-
+ if (Index-
return true;
+ }
}
-
return false;
}
#else