2 ms·
It's usually not about a single parent function and a called function. It's usually a long chain of calls where functions keep passing them around, from the poi
by kccqzy 3y ago
It's usually not about a single parent function and a called function. It's usually a long chain of calls where functions keep passing them around, from the point of construction. Imagine some function first creates that 24-byte object, then pass it around by pointer. Ten function calls later dereferencing that pointer will need access to main memory. Now imagine that first function passes the object by value; ten function calls later perhaps the contents of the object is duplicated on the stack ten times, but there's no cache miss.
It's a tradeoff between reducing memory usage and reducing cache misses.