Replaced OrderedDict
with dict
#7524
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
dict
is now assumed to be ordered in all currently supported versions of Python. This pull request changesOrderedDict
todict
across the project. While making the changes I did some tests to show the performance benefit.fromkeys()
(e.g. line 334 ofopenapi.py
)Conclusion
dict
is 19% fasterdict
from alist
(e.g line 221 of
pagination.py
)(e.g line 660 in
renderers.py
)Conclusion
dict
faster, 2% in the first example, 25% in the second. I suspect in practice the benefit is closer to the first; however, it is consistently faster.model_meta.py
)Conclusion
dict
is marginally (3%) faster