Created
March 11, 2015 09:22
-
-
Save lesteve/f85bdee54e582165b40f to your computer and use it in GitHub Desktop.
joblib simple benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
import numpy as np | |
np.random.seed(0) | |
N = int(1e7) | |
big_array = np.random.random(N) | |
big_dict = {i: np.random.random(10) for i in range(int(1e5))} | |
def test(joblib_module, to_pickle): | |
tic = time.time() | |
joblib_module.dump(to_pickle, '/tmp/big_array.gz', compress=1) | |
toc = time.time() | |
print('Dumping took {:.1f} s'.format(toc - tic)) | |
tic = time.time() | |
joblib_module.load('/tmp/big_array.gz') | |
toc = time.time() | |
print('Loading took {:.1f} s'.format(toc - tic)) | |
def test_harness(joblib): | |
print('=' * 80) | |
print('joblib file:', joblib.__file__) | |
print('-' * 20) | |
print('big array') | |
test(joblib, big_array) | |
print('-' * 20) | |
print('big dict') | |
test(joblib, big_dict) | |
from sklearn.externals import joblib as joblib_stable | |
import joblib as joblib_dev | |
print('Python: {0[0]}.{0[1]}'.format(sys.version_info)) | |
test_harness(joblib_stable) | |
test_harness(joblib_dev) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment