Created
June 8, 2018 14:54
-
-
Save pfreixes/bcdb11797655a36f5f91239666836674 to your computer and use it in GitHub Desktop.
JSON fallback for protobuf is so slow!
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
>>> timeit.timeit("""json.dumps({"name": "foo", "id":1})""", setup="from __main__ import json", number=10000) | |
0.04011281501152553 | |
>>> timeit.timeit("json_format.MessageToJson(person)", setup="from __main__ import json_format, person", number=10000) | |
0.2599130409944337 | |
>>> person | |
name: "foo" | |
id: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment