diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-02-20 23:37:13 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-02-20 23:37:13 +0000 |
commit | a725446766ae9e4b34f34c3f19e50c4df89b7e41 (patch) | |
tree | 4b3ddabc7dd53a0c6abe58cd1e1e1adc333ba5d7 /pym/portage | |
parent | 3a86686fc2b0af7e9f9f96b2e98c245c437ee613 (diff) | |
download | portage-a725446766ae9e4b34f34c3f19e50c4df89b7e41.tar.gz portage-a725446766ae9e4b34f34c3f19e50c4df89b7e41.tar.bz2 portage-a725446766ae9e4b34f34c3f19e50c4df89b7e41.zip |
When loading vdb_metadata.pickle inside vardbapi._aux_cache_init(), in
order to avoid an extreme performance issue, disable buffering when opening
the file under python-3.0. Unfortunately, performance is still poor relative
to python-2.x, but buffering makes it much worse.
svn path=/main/trunk/; revision=12665
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/dbapi/vartree.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 4877e68a9..cfabad844 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -35,6 +35,7 @@ from portage.cache.mappings import slot_dict_class import os, re, shutil, stat, errno, copy, subprocess import logging import shlex +import sys from itertools import izip try: @@ -1044,8 +1045,15 @@ class vardbapi(dbapi): def _aux_cache_init(self): aux_cache = None + open_kwargs = {} + if sys.hexversion >= 0x3000000: + # Buffered io triggers extreme performance issues in + # Unpickler.load() (problem observed with python-3.0.1). + # Unfortunately, performance is still poor relative to + # python-2.x, but buffering makes it much worse. + open_kwargs["buffering"] = 0 try: - f = open(self._aux_cache_filename, 'rb') + f = open(self._aux_cache_filename, mode='rb', **open_kwargs) mypickle = pickle.Unpickler(f) aux_cache = mypickle.load() f.close() |