Appending items onto arrays and array-like objects is common in many programming languages, with functions like JavaScript's Array.push and Python'...
For further actions, you may consider blocking this person and/or reporting abuse
The capacity doesn't always double. When it's grown to ~1024 (depends on OS) there applies another logic to increase the capacity of a slice.
This behavior changed in go 1.18 to more smooth allocation:
starting cap growth factor
256 2.0
512 1.63
1024 1.44
2048 1.35
4096 1.30
commit:
github.com/golang/go/commit/2dda92...
Thanks for the feedback! Will update the post with that info
Thanks @andyhaskell Nice write up.
One question about printing the address part:
does it print out the address of slice header or the underlying array?