summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:52:03 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:52:03 +0000
commitc1a2237722820dcd5e387dda5a88085cf62e68b9 (patch)
treed8767f5498575b70bf6bacdbe962c776f6b84bb2 /apt-pkg/pkgcachegen.cc
parentf826cfaa1c3f9fcf492fb65b22a2d964e78ae7ec (diff)
Optimizations
Author: jgg Date: 1998-12-07 07:26:19 GMT Optimizations
Diffstat (limited to 'apt-pkg/pkgcachegen.cc')
-rw-r--r--apt-pkg/pkgcachegen.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index bbf245b00..ccb6bedd4 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcachegen.cc,v 1.23 1998/11/13 04:23:33 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.24 1998/12/07 07:26:21 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -253,19 +253,28 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
if ((Dep->Version = WriteString(Version)) == 0)
return false;
}
-
+
// Link it to the package
Dep->Package = Pkg.Index();
Dep->NextRevDepends = Pkg->RevDepends;
Pkg->RevDepends = Dep.Index();
- // Link it to the version (at the end of the list)
- __apt_ptrloc *Last = &Ver->DependsList;
- for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
- Last = &D->NextDepends;
- Dep->NextDepends = *Last;
- *Last = Dep.Index();
+ /* Link it to the version (at the end of the list)
+ Caching the old end point speeds up generation substantially */
+ static pkgCache::VerIterator OldVer(Cache);
+ static __apt_ptrloc *OldLast;
+ if (OldVer != Ver)
+ {
+ OldLast = &Ver->DependsList;
+ for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
+ OldLast = &D->NextDepends;
+ OldVer = Ver;
+ }
+ Dep->NextDepends = *OldLast;
+ *OldLast = Dep.Index();
+ OldLast = &Dep->NextDepends;
+
return true;
}
/*}}}*/