Hacker News new | ask | show | jobs
by jupp0r 1878 days ago
Exactly! This is best achieved by keeping data on the stack and avoiding allocations as much as possible.
1 comments

The kind of data that is going to generate (enough) cache misses (to be a problem) behind your back is usually the stuff which you can't put on the stack.
It can also be lots of small careless allocations all over the place.
Yup, and go is particularly bad for this because it handles allocations automatically (and poorly). I can double a go program's performance by going through the memory profile and rearranging the instructions to minimize hidden applications.

The worst offender is slices, since you can't mark them read only or stack allocated.