You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CPU profile showed how the mRandomNodes was taking ~30% of the CPU time
of the gossip cycle.
Changing the data structure from a []string to a map allowed to improve
the performance of all the functions that were using it.
Following the comparison of the benchmarks before and after the change
AddNodeNetwork:
benchmark old ns/op new ns/op delta
BenchmarkAddNetworkNode-4 1859 181 -90.26%
benchmark old allocs new allocs delta
BenchmarkAddNetworkNode-4 1 1 +0.00%
benchmark old bytes new bytes delta
BenchmarkAddNetworkNode-4 15 15 +0.00%
DelNodeNetwork:
benchmark old ns/op new ns/op delta
BenchmarkDeleteNetworkNode-4 71.0 75.8 +6.76%
benchmark old allocs new allocs delta
BenchmarkDeleteNetworkNode-4 0 0 +0.00%
benchmark old bytes new bytes delta
BenchmarkDeleteNetworkNode-4 3 7 +133.33%
RandomNode:
benchmark old ns/op new ns/op delta
BenchmarkRandomNodes-4 1830 172 -90.60%
benchmark old allocs new allocs delta
BenchmarkRandomNodes-4 16 1 -93.75%
benchmark old bytes new bytes delta
BenchmarkRandomNodes-4 535 48 -91.03%
Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
0 commit comments