Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 196987 Details for
Bug 276813
sys-apps/portage Performance improvement
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
cache_heavy_regexes.patch
cache_heavy_regexes.patch (text/plain), 2.85 KB, created by
Marat Radchenko
on 2009-07-07 06:27:51 UTC
(
hide
)
Description:
cache_heavy_regexes.patch
Filename:
MIME Type:
Creator:
Marat Radchenko
Created:
2009-07-07 06:27:51 UTC
Size:
2.85 KB
patch
obsolete
>diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py >index c2eaf0e..366d20e 100644 >--- a/pym/_emerge/Package.py >+++ b/pym/_emerge/Package.py >@@ -16,6 +16,7 @@ except ImportError: > from portage.cache.mappings import slot_dict_class > from portage.dep import paren_reduce, use_reduce, \ > paren_normalize, paren_enclose >+from portage.util import re_compile > from _emerge.Task import Task > > class Package(Task): >@@ -112,7 +113,7 @@ class Package(Task): > regex = (re.escape(x) for x in \ > chain(self.all, self.iuse_implicit)) > regex = "^(%s)$" % "|".join(regex) >- regex = re.compile(regex.replace("\\.\\*", ".*")) >+ regex = re_compile(regex.replace("\\.\\*", ".*")) > self._regex = regex > return regex > >diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py >index abd6cc8..cc9c95f 100644 >--- a/pym/portage/dbapi/__init__.py >+++ b/pym/portage/dbapi/__init__.py >@@ -12,7 +12,7 @@ portage.proxy.lazyimport.lazyimport(globals(), > 'portage.dep:match_from_list', > 'portage.locks:unlockfile', > 'portage.output:colorize', >- 'portage.util:cmp_sort_key,writemsg', >+ 'portage.util:cmp_sort_key,re_compile,writemsg', > 'portage.versions:catpkgsplit,vercmp', > ) > >@@ -157,12 +157,12 @@ class dbapi(object): > except KeyError: > continue > use = use.split() >- iuse = self._iuse_implicit.union( >- re.escape(x.lstrip("+-")) for x in iuse.split()) >- iuse_re = re.compile("^(%s)$" % "|".join(iuse)) >+ iuse = [re.escape(x.lstrip("+-")) for x in iuse.split()] >+ iuse_re = re_compile("^(%s)$" % "|".join(iuse)) >+ iuse_implicit_re = re_compile("^(%s)$" % "|".join(self._iuse_implicit)) > missing_iuse = False > for x in atom.use.required: >- if iuse_re.match(x) is None: >+ if iuse_re.match(x) is None and iuse_implicit_re.match(x) is None: > missing_iuse = True > break > if missing_iuse: >diff --git a/pym/portage/util.py b/pym/portage/util.py >index 4ccd512..1148b58 100644 >--- a/pym/portage/util.py >+++ b/pym/portage/util.py >@@ -8,12 +8,13 @@ __all__ = ['apply_permissions', 'apply_recursive_permissions', > 'getconfig', 'getlibpaths', 'grabdict', 'grabdict_package', 'grabfile', > 'grabfile_package', 'grablines', 'initialize_logger', 'LazyItemsDict', > 'map_dictlist_vals', 'new_protect_filename', 'normalize_path', >- 'pickle_read', 'stack_dictlist', 'stack_dicts', 'stack_lists', >+ 'pickle_read', 're_compile' 'stack_dictlist', 'stack_dicts', 'stack_lists', > 'unique_array', 'varexpand', 'write_atomic', 'writedict', 'writemsg', > 'writemsg_level', 'writemsg_stdout'] > > import codecs > import os >+import re > import errno > import logging > import shlex >@@ -1297,3 +1298,12 @@ def getlibpaths(root): > rval.append("/lib") > > return [normalize_path(x) for x in rval if x] >+ >+re_cache = {} >+ >+def re_compile(regex): >+ result = re_cache.get(regex) >+ if result is None: >+ result = re.compile(regex) >+ re_cache[regex] = result >+ return result
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 276813
:
196987
|
197434
|
197437
|
197827
|
198253
|
203267
|
203269
|
203406
|
203509
|
203512
|
203515
|
203519
|
204572
|
204597
|
204673
|
204685
|
204770
|
204883
|
204996
|
205039