protofuse Posted April 3, 2010 Report Posted April 3, 2010 just a little question. what is the most efficient option? 1/ variables globally declared and used in SR_Service_Prepare() 2/ variables locally declared inside SR_Service_Prepare() and used in SR_Service_Prepare() I guess in the case 2/ each time the SR_Service_Prepare() is called, declarations eat cpu time ... right ? so it may be the 1/ to choose ?!
TK. Posted April 3, 2010 Report Posted April 3, 2010 2) is the most efficient solution as it only allocates local stack (in zero time) - but take care that stack memory is limited (1024 bytes), don't declare huge arrays there 1) is expensive since it allocates RAM statically, and it's bad programming style - you want to avoid the usage of global variables whenever possible. Best Regards, Thorsten.
protofuse Posted April 3, 2010 Author Report Posted April 3, 2010 I was almost sure I had to ask this :) thanks a lot. I understand the logic under the hood
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now