for module in modules:
    start = time()
if module.__name__ in ['pickle', 'cPickle']:
    for i in range(test_runs):
        serialized = module.dumps(data, protocol=-1)
else:
    for i in range(test_runs):
        serialized = module.dumps(data)
w = time() - start
start = time()
for i in range(test_runs):
    unserialized = module.loads(serialized)
r = time() - start
print('%s %s W %.3f R %.3f' % (module.__name__, payload_type, w, r))
Как сократить время загрузки файла рассола в python