3 ms·
You can use memcpy to remove items from the middle of a memory segment. It's probably not a single memory segment either; I imagine it works more like a Golang
by Rapzid 7y ago
You can use memcpy to remove items from the middle of a memory segment. It's probably not a single memory segment either; I imagine it works more like a Golang slice.
- ummonk 7y agoMemcpy is certainly O(N). But yeah, if they implement it with multiple slices (e.g. a B tree) it could be fast.
- Rapzid 7y agoHrm, I'm pretty sure I meant memmove: https://golang.org/src/runtime/slice.go https://golang.org/src/runtime/slice.go EDIT: I could have sworn they were shifting entire pages around without using a cycle per byte but I can't find any reference to that now haha.
- jameshart 7y agoGreat, you recovered the memory. But now you have to update all the pointers to the array in the hashmap....