Skip to content

[mypyc] Optimize construction via list() & dict() #10918

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ichard26
Copy link
Collaborator

@ichard26 ichard26 commented Aug 3, 2021

Description

Resolves mypyc/mypyc#882.

Instead of loading the type and calling it via the vectorcall convention let's use PyList_New / PyDict_New directly to create these empty collections. This mimics the behaviour constructing empty list and dict literals.

Test Plan

  • Added two more irbuild test cases, one for each type
  • Built the mypyc documentation locally and checked it for any markup issues

Instead of loading the type and calling it via the vectorcall
convention let's use PyList_New / PyDict_New directly to create these
empty collections.
@ichard26 ichard26 changed the title Optimize construction via list() & dict() [mypyc] Optimize construction via list() & dict() Aug 3, 2021
Copy link
Collaborator

@97littleleaf11 97littleleaf11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hauntsaninja hauntsaninja merged commit 989d600 into python:master Aug 3, 2021
@ichard26
Copy link
Collaborator Author

ichard26 commented Aug 3, 2021

Thanks @97littleleaf11 for the review!

@ichard26 ichard26 deleted the optimize-list-and-dict-construction branch August 3, 2021 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize empty collections creation: list() and dict()
3 participants