public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-portage-dev] [PATCH] similar_name_search: used indexed repos where appropriate (bug 556764)
@ 2015-08-06  5:09 99% Zac Medico
  0 siblings, 0 replies; 1+ results
From: Zac Medico @ 2015-08-06  5:09 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

This reduces the time of 'emerge --info foo' by roughly 24% on my
laptop.

X-Gentoo-Bug: 556764
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=556764
---
 pym/_emerge/actions.py  | 7 +++++--
 pym/_emerge/depgraph.py | 6 +++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 92d1f2e..01aef51 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -42,6 +42,8 @@ from portage.const import GLOBAL_CONFIG_PATH, VCS_DIRS, _DEPCLEAN_LIB_CHECK_DEFA
 from portage.const import SUPPORTED_BINPKG_FORMATS, TIMESTAMP_FORMAT
 from portage.dbapi.dep_expand import dep_expand
 from portage.dbapi._expand_new_virt import expand_new_virt
+from portage.dbapi.IndexedPortdb import IndexedPortdb
+from portage.dbapi.IndexedVardb import IndexedVardb
 from portage.dep import Atom, _repo_separator, _slot_separator
 from portage.eclass_cache import hashed_path
 from portage.exception import InvalidAtom, InvalidData, ParseError
@@ -1513,9 +1515,10 @@ def action_info(settings, trees, myopts, myfiles):
 				writemsg("\nemerge: searching for similar names..."
 					, noiselevel=-1)
 
-				dbs = [vardb]
+				search_index = myopts.get("--search-index", "y") != "n"
+				dbs = [IndexedVardb(vardb) if search_index else vardb]
 				#if "--usepkgonly" not in myopts:
-				dbs.append(portdb)
+				dbs.append(IndexedPortdb(portdb) if search_index else portdb)
 				if "--usepkg" in myopts:
 					dbs.append(bindb)
 
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index a957108..57040ab 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -21,6 +21,7 @@ from portage.const import PORTAGE_PACKAGE_ATOM, USER_CONFIG_PATH, VCS_DIRS
 from portage.dbapi import dbapi
 from portage.dbapi.dep_expand import dep_expand
 from portage.dbapi.DummyTree import DummyTree
+from portage.dbapi.IndexedPortdb import IndexedPortdb
 from portage.dbapi._similar_name_search import similar_name_search
 from portage.dep import Atom, best_match_to_list, extract_affecting_use, \
 	check_required_use, human_readable_required_use, match_from_list, \
@@ -5100,10 +5101,13 @@ class depgraph(object):
 				writemsg("\nemerge: searching for similar names..."
 					, noiselevel=-1)
 
+				search_index = self._frozen_config.myopts.get("--search-index", "y") != "n"
+				# fakedbapi is indexed
 				dbs = [vardb]
 				if "--usepkgonly" not in self._frozen_config.myopts:
-					dbs.append(portdb)
+					dbs.append(IndexedPortdb(portdb) if search_index else portdb)
 				if "--usepkg" in self._frozen_config.myopts:
+					# bindbapi is indexed
 					dbs.append(bindb)
 
 				matches = similar_name_search(dbs, atom)
-- 
2.4.6



^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-08-06  5:09 99% [gentoo-portage-dev] [PATCH] similar_name_search: used indexed repos where appropriate (bug 556764) Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox