mikeywaites / kim

Kim: A JSON Serialization and Marshaling framework
http://kim.readthedocs.org/en/latest/
Other
317 stars 17 forks source link

Improve performance of update_output_to_name #141

Closed jackqu7 closed 7 years ago

jackqu7 commented 7 years ago

update_output_to_name is extremely hot code during serialisation as it is called for every single filling. The previous implementation supported output being both an object and a dict, but there is no way to change the type of output - it is always a dict, so this functionality was never used.

Because this support involved a try except block, which are generally slow, it caused a significant performance issue.

Serialising a real world dataset with a list of objects containing ~5700 total keys, a 10% performance improvement was obtained by removing this try except block.