3 ms·
> Giving maps a runtime penalty of random iteration in order just to punish devs who don't read docs is annoying Can you explain what you mean by "runtime pena
by nemo1618 6y ago
> Giving maps a runtime penalty of random iteration in order just to punish devs who don't read docs is annoying
Can you explain what you mean by "runtime penalty?" Last I checked, the iteration is only random wrt its starting offset; after that, it proceeds linearly through the buckets. So you only generate one random integer per `range`, which seems acceptably cheap.
- scaladev 6y agoIt still seems to be working as you described. https://github.com/golang/go/blob/db8142fb8631df3ee56983cbc13db997c16f2f6f/src/runtime/map.go#L831 https://github.com/golang/go/blob/db8142fb8631df3ee56983cbc1...