Let's say I have an algorithm triggerd periodically by a timer interrupt on a microcontroller. Let's also assume that I have loads of memory to play with and speed of execution is my only concern. If there are local variables inside that algorithm, is there a performance benefit from declaring them as static versus having them allocated on the stack every time the function is called? What would be the pros and cons?