-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mypyc] Avoid cyclic reference in nested functions (#16268)
Mypyc used to always put nested functions into the environment object, which results in cyclic references, since the function object contains a reference to the environment. Now we only do this if the body of a nested function refers to a nested function (e.g. due to a recursive call). This means that in the majority of cases we can avoid the cyclic reference. This speeds up self check by an impressive 7%. I'm not sure exactly why the impact is so big, but spending less time in the cyclic garbage collector is probably a big part.
- Loading branch information
Showing
6 changed files
with
305 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.