-
-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The 'node' function non-atomically loaded an existing node or created a new one. This could lead to two goroutines each creating new nodes. This would ultimately lead to false positives when checking a package and its test variant, because objects wouldn't be deduplicated correctly. Instead of using LoadOrStore, we switch away from sync.Map completely and use coarse locking on normal maps. Using LoadOrStore would require us to allocate nodes just to throw them away afterwards, at a high rate. At the same time, using normal maps + a mutex does not have a measurable performance impact – as determined by benchmarking against the standard library. We also remove the context-local typeNodes map. It served as a lock-free fast path, but benchmarking shows that it has no measurable performance impact, either. Thanks to Caleb Spare for uncovering this fairly embarrassing blunder. Closes gh-642
- Loading branch information
Showing
1 changed file
with
41 additions
and
45 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