Skip to content

Instantly share code, notes, and snippets.

@vsoch
Created April 24, 2015 03:44
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsoch/61a82e7c920468325ea8 to your computer and use it in GitHub Desktop.
Save vsoch/61a82e7c920468325ea8 to your computer and use it in GitHub Desktop.
Joblib vs Pickle
from sklearn.externals import joblib
import time
import numpy
import pickle
bigarray = numpy.zeros([190,91,190])
bigarray = bigarray.flatten()
### Saving
start = time.time()
joblib.dump(bigarray,"bigarray1.pkl")
end = time.time() - start
end
# 0.31264686584472656
start = time.time()
pickle.dump(bigarray,open("bigarray2.pkl","wb"))
end = time.time()-start
end
# 4.827500104904175
### Loading
start = time.time()
joblib.load("bigarray1.pkl")
end = time.time() - start
end
# 0.47748589515686035
start = time.time()
pickle.load(open("bigarray2.pkl","rb"))
end = time.time()-start
end
# 0.7575929164886475
@GaelVaroquaux
Copy link

Hey Vanessa, I had looked at this page quickly on my mobile phone, and thus not noticed that the timing were in. Sorry for the request, which was pointless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment