Skip to content

Instantly share code, notes, and snippets.

@redbo
Created April 11, 2015 00:16
Show Gist options
  • Save redbo/9bd35a2af636304589e5 to your computer and use it in GitHub Desktop.
Save redbo/9bd35a2af636304589e5 to your computer and use it in GitHub Desktop.
import cPickle
import time
metadata = {"Content-Length": "65536",
"Content-Type": "application/octet-stream",
"ETag": "fcd6bcb56c1689fcef28b57c22475bad",
"X-Timestamp": "1422766779.57463",
"name": "/someaccountname/somecontainername/5821142269423797100"}
loops = 200000
start = time.time()
for i in xrange(loops):
cPickle.dumps(metadata)
print 'cPickle.dumps %d ns/op' % (((time.time() - start) * 1000000000) / loops)
dumped = cPickle.dumps(metadata)
start = time.time()
for i in xrange(loops):
cPickle.loads(dumped)
print 'cPickle.loads %d ns/op' % (((time.time() - start) * 1000000000) / loops)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment