Matthew Martin β β
π on Nostr: Wow, ast.literal_eval and eval are slow. Serialization/Deserialization ...
Wow, ast.literal_eval and eval are slow.
Serialization/Deserialization
------------------------------
Pickle: 0.7 seconds
JSON: 2.8 seconds
HBN (repr +ast.literal_eval): 23.4 seconds
HBN (repr + eval): 22.2 seconds
The slow part is the eval, the repr part is only 1.1 seconds
#python
Published at
2023-08-12 15:46:34Event JSON
{
"id": "a833d7cfd12f07ecb17643800ba6e237c9f764d92232163296ba7c6b6ff45a8d",
"pubkey": "ece51acfc6c84a5f625a755bed921f6eac6a9daa6f90817047901dbe0231522f",
"created_at": 1691855194,
"kind": 1,
"tags": [
[
"t",
"python"
],
[
"proxy",
"https://mastodon.social/users/mistersql/statuses/110877422044215927",
"activitypub"
]
],
"content": "Wow, ast.literal_eval and eval are slow.\n\nSerialization/Deserialization\n------------------------------\nPickle: 0.7 seconds\nJSON: 2.8 seconds\nHBN (repr +ast.literal_eval): 23.4 seconds\nHBN (repr + eval): 22.2 seconds\n\nThe slow part is the eval, the repr part is only 1.1 seconds\n\n#python",
"sig": "596c9bbeafdac63c6a42d44140453a849aea999f8d36c3c5b67585b3d4c00400ffd1d47558e9686dcb7fc8405cb169f8f2b28ef281109809e82038999f21c11a"
}