Need Assistance?

support@tutorialshub.in

Arrays, Slices & Maps

Pre-Allocating with make() & append()

ADVERTISEMENT
Go (Golang) Free Lesson
5 min read
ADVERTISEMENT

When you know roughly how many items you'll append, pre-allocate capacity with make([]int, 0, 100) to avoid repeated memory allocations.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you