From: Zac Medico Date: Sun, 19 Jul 2009 22:02:00 +0000 (-0000) Subject: Use readlines() to optimize performance. Thanks to Marat Radchenko X-Git-Tag: v2.2_rc34~38 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=07a9cfb93ad567b16baae38c4fe2f3ea4e2f4e9b;p=portage.git Use readlines() to optimize performance. Thanks to Marat Radchenko for this patch from bug #276813. svn path=/main/trunk/; revision=13834 --- diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index 71ddf6023..c3c5955fb 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -29,7 +29,7 @@ class database(fs_template.FsBased): try: myf = codecs.open(fp, mode='r', encoding='utf_8', errors='replace') try: - d = self._parse_data(myf, cpv) + d = self._parse_data(myf.readlines(), cpv) if '_mtime_' not in d: # Backward compatibility with old cache # that uses mtime mangling. diff --git a/pym/portage/cache/metadata.py b/pym/portage/cache/metadata.py index 724dce3cc..b51bf980f 100644 --- a/pym/portage/cache/metadata.py +++ b/pym/portage/cache/metadata.py @@ -34,7 +34,6 @@ class database(flat_hash.database): def _parse_data(self, data, cpv): _hashed_re_match = self._hashed_re.match - data = list(data) d = {} for line in data: