← Back to context

Comment by porridgeraisin

15 hours ago

They actually do it without needing a O(n) memory chunk, aiui.

1. choose starting bucket randomly

2. From there iterate through buckets in usual order (wrapping around)

3. Within each bucket, generate permutation of 0..7, and stream it in that order.

See func mapiterinit() in runtime/map.go

This is just me musing, but you can probably precompute all permutations of 0..7 and store it for ~20KB once for the whole runtime, and just index that each time. Can avoid the fischer yates each time.