summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-11 06:01:59 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-11 06:01:59 +0000
commit09621d445e87c102869e5c97898fda55c217d643 (patch)
tree515d402298b5874e466a01fa5a4f3ccf4aa332c2
parent161bbea42b3bb0b564b9b2a61aaac0f19a733c0d (diff)
downloadportage-09621d445e87c102869e5c97898fda55c217d643.tar.gz
portage-09621d445e87c102869e5c97898fda55c217d643.tar.bz2
portage-09621d445e87c102869e5c97898fda55c217d643.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. (trunk r12665) svn path=/main/branches/2.1.6/; revision=12928
-rw-r--r--pym/portage/dbapi/vartree.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 3c8ece366..f65afb6bd 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:
@@ -389,8 +390,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()