-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime maps: random iteration and maps.clone #4476
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it ironic that big Go said map iteration order is undefined, so made map iteration random, and now there's a lot of code depending on the random iteration order.
(There's a difference between random and undefined! Always producing the map keys in sorted order would be entirely valid according to the Go spec).
Anyway, see my comment below. Didn't investigate the code that changes the iteration order in detail, but it seems reasonable on the surface.
func hashmapClone(intf _interface) _interface { | ||
typ, val := decomposeInterface(intf) | ||
m := (*hashmap)(val) | ||
n := hashmapCopy(m, m.bucketBits) | ||
return composeInterface(typ, unsafe.Pointer(&n)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I didn't think of reusing the growing code for map cloning.
fb43c1d
to
cbb87af
Compare
03c03fe
to
10872fc
Compare
Need to fix the binary sizes again .. |
10872fc
to
423a0df
Compare
423a0df
to
2ac273f
Compare
This PR fixes a few map-related issues:
math/bits
andencoding/binary
.maps.clone
so themaps
package can use it.