How Go 1.15 improved converting small integer values to interfaces
https://utcc.utoronto.ca/~cks/space/blog/programming/Go115InterfaceSmallInts [utcc.utoronto.ca]
2020-08-17 04:31
The answer turns out to be pretty straightforward, and is in Go CL 216401 (merged in this commit, which may be easier to read). The Go runtime has a special static array of the first 256 integers (0 to 255), and when it would normally have to allocate memory to store an integer on the heap as part of converting it to an interface, it first checks to see if it can just return a pointer to the appropriate element in the array instead. This kind of static allocation of frequently used values is common in languages with lots of dynamic allocation; Python does something similar for small integers, for example (which can sometimes surprise you).
source: L