-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
subScope: use a slice of tags instead of a map (#97)
* subScope: use a slice of tags instead of a map This commit changes the subScope to keep a slice of tags instead of a map. This means that we no longer modify or "own" the map we're passed, which has been a source of bugs recently (that gostats owns any map passed to it was poorly, if at all, documented). This change also improves performance by 2x and reduces memory usage and GC pressure as each subScope will no longer be holding a map (which is sparse and the GC must scan). This change also moves us closer to passing tags via a slice (instead of a map) which is a change that I intend to make part of the V1 release (assuming I ever get around to that). ``` benchmark old ns/op new ns/op delta BenchmarkStore_ScopeWithTags-12 1321 646 -51.10% BenchmarkStore_ScopeNoTags-12 583 179 -69.30% benchmark old allocs new allocs delta BenchmarkStore_ScopeWithTags-12 4 3 -25.00% BenchmarkStore_ScopeNoTags-12 4 2 -50.00% benchmark old bytes new bytes delta BenchmarkStore_ScopeWithTags-12 544 512 -5.88% BenchmarkStore_ScopeNoTags-12 304 112 -63.16% ``` * Update tags.go Co-authored-by: Max R <[email protected]> * stats_test: code review comments * tags_test: benchmark tagSet.Search * tags: rename CompareAndSwap => cas and document network sort * tags: save alloc in replaceChars Co-authored-by: Max R <[email protected]>
- Loading branch information
1 parent
cf86465
commit d95cbc0
Showing
5 changed files
with
1,014 additions
and
95 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
Oops, something went wrong.