Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import simplejson as json
- import msgpack
- import timeit
- def test_json():
- with open('test.json') as fh:
- json.load(fh)
- def test_msgpack():
- with open('test.msgpack') as fh:
- msgpack.load(fh)
- if __name__ == "__main__":
- for test in ('json', 'msgpack'):
- print test,
- print timeit.timeit(
- '__main__.test_{0}()'.format(test),
- setup='import __main__',
- number=10000
- )
Add Comment
Please, Sign In to add comment