-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treewalker: Improve performance by avoiding memory allocations (#309)
Previously the treewalker would unnecessary call "to_h" on each Protobuf message in the parsetree, in order to get the field names to walk. This caused unnecessary copies of the message, increasing memory usage and slowing down the tree walk. Instead, use the Protobuf descriptor and its field descriptors to walk the message. Additionally this also optimizes the case where a block with 1 argument is used for the tree walk, since we don't need to handle the location, avoiding unnecessary copies of the field name string. Together these changes result in about a 5x speed up in some use cases.
- Loading branch information
Showing
4 changed files
with
41 additions
and
14 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