From: Zac Medico Date: Sat, 16 Dec 2006 02:10:05 +0000 (-0000) Subject: Cache KEYWORDS and EAPI metadata values in order to speed up portdbapi.gvisible(... X-Git-Tag: v2.1.2~294 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=25ded51d2804109347a3a6fa96ef44e4a7833df0;p=portage.git Cache KEYWORDS and EAPI metadata values in order to speed up portdbapi.gvisible() calls. This greatly improves repoman performance (help emerge a little too). svn path=/main/trunk/; revision=5298 --- diff --git a/pym/portage.py b/pym/portage.py index 3e77d53c3..d2c81798f 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5163,6 +5163,7 @@ class portdbapi(dbapi): for x in self.porttrees: # location, label, auxdbkeys self.auxdb[x] = self.auxdbmodule(self.depcachedir, x, filtered_auxdbkeys, gid=portage_gid) + self._gvisible_aux_cache = {} def _init_cache_dirs(self): """Create /var/cache/edb/dep and adjust permissions for the portage @@ -5682,15 +5683,20 @@ class portdbapi(dbapi): #we need to update this next line when we have fully integrated the new db api auxerr=0 keys = None - try: - keys, eapi = self.aux_get(mycpv, ["KEYWORDS", "EAPI"]) - except KeyError: - pass - except portage_exception.PortageException, e: - writemsg("!!! Error: aux_get('%s', ['KEYWORDS', 'EAPI'])\n" % mycpv, - noiselevel=-1) - writemsg("!!! %s\n" % str(e), - noiselevel=-1) + aux_cache = self._gvisible_aux_cache.get(mycpv) + if aux_cache is not None: + keys, eapi = aux_cache + else: + try: + keys, eapi = self.aux_get(mycpv, ["KEYWORDS", "EAPI"]) + except KeyError: + pass + except portage_exception.PortageException, e: + writemsg("!!! Error: aux_get('%s', ['KEYWORDS', 'EAPI'])\n" % mycpv, + noiselevel=-1) + writemsg("!!! %s\n" % str(e), + noiselevel=-1) + self._gvisible_aux_cache[mycpv] = (keys, eapi) if not keys: # KEYWORDS="" #print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status"