Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f21406

Browse files
committed
Using cPickle in BigArray (faster and potentially less memory used)
1 parent 8dac47f commit 9f21406

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/core/bigarray.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
See the file 'doc/COPYING' for copying permission
66
"""
77

8+
try:
9+
import cPickle as pickle
10+
except:
11+
import pickle
12+
813
import os
9-
import pickle
1014
import tempfile
1115

1216
from lib.core.settings import BIGARRAY_CHUNK_LENGTH
@@ -62,7 +66,7 @@ def _dump(self, value):
6266
self.filenames.add(filename)
6367
os.close(handle)
6468
with open(filename, "w+b") as fp:
65-
pickle.dump(value, fp)
69+
pickle.dump(value, fp, pickle.HIGHEST_PROTOCOL)
6670
return filename
6771

6872
def _checkcache(self, index):

0 commit comments

Comments
 (0)