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
Map in the standard Go library (afaik even sync.Map) has an indeterministic iteration order. On each iteration a random point is chosen. They have various reasons for that, performance (golang/go#8412) or preventing bad codes relying on fixed iteration order.
Currently Map/MapOf.Range methods have a fixed iteration order for a stable map. Would you consider applying some randomness similar to standard library? For example starting from a random bucket instead of the first bucket.
The text was updated successfully, but these errors were encountered:
In case of xsync, such randomization won't improve performance, but preventing bad code relying on fixed iteration order may be valuable for someone. Let me keep this issue around and see if anyone else requests it.
The implementation could be as simple as starting the iteration with a randomly selected bucket.
Map in the standard Go library (afaik even sync.Map) has an indeterministic iteration order. On each iteration a random point is chosen. They have various reasons for that, performance (golang/go#8412) or preventing bad codes relying on fixed iteration order.
Currently
Map/MapOf.Range
methods have a fixed iteration order for a stable map. Would you consider applying some randomness similar to standard library? For example starting from a random bucket instead of the first bucket.The text was updated successfully, but these errors were encountered: