Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
hauntsaninja merged 1 commit into
python:masterfrom
ichard26:optimize-list-and-dict-construction
Aug 3, 2021
Merged

[mypyc] Optimize construction via list() & dict()#10918
hauntsaninja merged 1 commit into
python:masterfrom
ichard26:optimize-list-and-dict-construction

Conversation

@ichard26

@ichard26 ichard26 commented Aug 3, 2021

Copy link
Copy Markdown
Collaborator

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

@97littleleaf11 97littleleaf11 left a comment

Copy link
Copy Markdown
Collaborator

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

ichard26 commented Aug 3, 2021

Copy link
Copy Markdown
Collaborator Author

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