1
0
forked from VimPlug/jedi

Disabling gc while loading pickles for a 20% speed boost on larger libs

This commit is contained in:
Steven Silvester
2013-10-06 06:26:36 -05:00
parent b6c30b542a
commit 9cac894273
2 changed files with 8 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ import os
import sys
import json
import hashlib
import gc
try:
import cPickle as pickle
except ImportError:
@@ -256,8 +257,12 @@ class _ModulePickling(object):
return None
with open(self._get_hashed_path(path), 'rb') as f:
parser_cache_item = pickle.load(f)
try:
gc.disable()
parser_cache_item = pickle.load(f)
finally:
gc.enable()
debug.dbg('pickle loaded', path)
parser_cache[path] = parser_cache_item
return parser_cache_item.parser