title: C performance on a PIC board global variables vs. method local
body: <p>All,</p>
  
  <p>I have C functions that are called many times a second as they are part of a control loop on a PIC18 board.  These functions have variables that only need method scope, but I was wondering what if any overhead there was to constantly allocating these variables vs. using a global or at least higher scoped variable. (Thought of typedef'ing a struct to pass around from a higher scope to avoid global variable use if performance dictates not using method local varables)</p>
  
  <p>There are some good threads on here that cover this topic, but I have yet to see a definitive answer as most preach best practices which I agree and would follow as long as there are not performance gains to be had as every microsecond counts. </p>
  
  <p>One thread mentioned using file scoped static variables as a substitute for global variables, but I can't help wonder if even that is necessary. </p>
  
  <p>What does everyone think?</p>