If a large const array or struct is on the stack, make it static const so that the data does not have to be populated on the stack each time a function is entered. I keep on finding these in the kernel.
Yup, I don't disagree -- but where it's _possible_, it should be done. There's no reason that a local const structure or array should live anywhere except in .rodata.
-
-
I agree too. The expectation is to do the "safe" thing. Just shoving auto const variables on the stack is sometimes more performance optimal because it's cache hot and still complies with the spec, so I guess maybe why it's done that way.
-
Can we throw Coccinelle at this?
-
I believe this has been done already.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.