Slice
Add/Remove from Middle
Remove an element from the middle of a slice.
Performance Consideration
The builtin append()
needs to create a new backing array if the capacity of the destination slice is less than what the length of the slice would be after the append. This also requires to copy the current elements from destination to the newly allocated array, so there are much overhead.
Sort
I can use Golang's sort package but my data type must implement the sort interface.
Last updated