-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
base: optimize {NodeIDContainer,StoreIDContainer}.String()
These String() methods were implemented in terms of their respective SafeFormat, which was pretty expensive: upwards of 750ns and between 4-7 allocations depending on the node id. This cost caused at least two workarounds, that the patch annotates. The patch makes stringifying cheap by precomputing the value and moving from SafeFormatter to SafeValue. Moving away from SafeFormatter to a more down-to-earth implementation brings the cost down to between 0 and 1 allocations. But I went further and precomputed the value because these containers are used as logging tags and so can easily end up being stringified very frequently. Release note: None
- Loading branch information
1 parent
787d028
commit 295689b
Showing
4 changed files
with
45 additions
and
27 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