Use readlines() to optimize performance. Thanks to Marat Radchenko
authorZac Medico <zmedico@gentoo.org>
Sun, 19 Jul 2009 22:02:00 +0000 (22:02 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 19 Jul 2009 22:02:00 +0000 (22:02 -0000)
<slonopotamusorama@gmail.com> for this patch from bug #276813.

svn path=/main/trunk/; revision=13834

pym/portage/cache/flat_hash.py
pym/portage/cache/metadata.py

index 71ddf6023afc0387139053166e00fdbbcc918d5c..c3c5955fb211b4c970e812e087b3838714bf8bcd 100644 (file)
@@ -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.
index 724dce3ccbcbaa2a8e42d06a9c2aeb647835bc76..b51bf980f0ea0b8a245a8c4c7418f4ab5bd4fe2c 100644 (file)
@@ -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: