-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ring: reduce allocations and copies when Merge()-ing states. (#77)
Instead of creating copies of the "Ingesters" maps when normalizing, normalize them in-place. This reduces the overhead of creating new maps only to discard the source versions shortly after. Two additional changes yielded also yielded some improvement: - When checking for LEFT states, don't update the map unless necessary. - Collapsing the two loops into one, avoiding iterating the map twice. ``` name old time/op new time/op delta MemberlistReceiveWithRingDesc-6 1.01ms ± 6% 0.44ms ±15% -56.56% (p=0.000 n=9+9) name old alloc/op new alloc/op delta MemberlistReceiveWithRingDesc-6 254kB ± 0% 16kB ± 0% -93.85% (p=0.000 n=10+9) name old allocs/op new allocs/op delta MemberlistReceiveWithRingDesc-6 637 ± 0% 612 ± 0% -3.92% (p=0.000 n=10+9) ```
- Loading branch information
Showing
3 changed files
with
16 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