Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
JSON encoder can produce output sorted by key (json.dumps(sort_keys=True)) The default value forsort_keys isFalse. The code always creates a list of dictionary items, sorts them if needed, and then iterates through them.
However, if sorting is not requested we can usePyDict_Next to avoid allocating a list of tuples.
pyperformance on my machine before changes:
### json_dumps ###Mean +- std dev: 10.6 ms +- 0.1 mspyperformance after changes:
### json_dumps ###Mean +- std dev: 9.00 ms +- 0.08 msMetadata
Metadata
Assignees
Labels
Projects
Status
Done