-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance improvements to counter context.clone slowdown (#1009)
* Add limit to the total number of nodes inferred per context This change abuses mutable references to create a sort of interior mutable cell shared between a context and all of its clones. The idea is that when a node is inferred at the toplevel, it is called with context = None, creating a new InferenceContext and starting a count from zero. However, when a context is cloned we re-use the cell and cause the count in the "parent" context to be incremented when nodes are inferred in the "child" context. * Add global inference cache * Update safe_infer to catch StopIteration
- Loading branch information
Showing
5 changed files
with
64 additions
and
15 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
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