I find entry use array for storage in struct segment.
This approach requires the implementation of get, set interfaces and expansion logic.
type segment struct {
// ...
slotLens [256]int32 // The actual length for every slot.
slotCap int32 // max number of entry pointers a slot can hold.
slotsData []entryPtr // shared by all 256 slots
}
Why not use golang map?
- golang map has achieved hash and expansion logic
- if map value is data address offset instead of data pointer, the GC will omit its content.
I find entry use array for storage in struct segment.
This approach requires the implementation of get, set interfaces and expansion logic.
Why not use golang map?