Page 2 of 2

Re: Minimizing local variable declarations

Posted: Tue Aug 23, 2011 4:22 pm
by Rebornxeno
It was actually just the simple things like grouping related variables together because they likely get called together, and unwrapping a bit. I have a variable that I use in a function that iterates thousands of times before completing, and every iteration I had it re-calculate that variable. On the pdf there was a slide showing using a temp variable to keep some value to be re-used many times in cache, I did that, and voila my program halfed its execution time. If only I was using c++, I see a few more spots where putting things in a temp cache location would be tremendously helpful but java doesn't use pointers and such :(