Re: Declaring local variables inside loop
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Thu, 23 Feb 2006 14:47:24 GMT
On Wed, 22 Feb 2006 12:54:50 +0100, Hendrik Maryns
<hendrik_maryns@xxxxxxxxxxxxx> wrote, quoted or indirectly quoted
someone who said :
Now my question is: does it matter that I declare tupleWithSecond
outside the loop? I have the impression that if I leave the first line
out and instead add ?FunctionInputTuple? before the third line, that a
new pointer space is created on the stack for each loop.
all slots on the stack frame for locals are allocated by a single
addition(subtraction) of the stack pointer on entering the method.
The advantage of putting them inside:
1. helps an optimiser. It know they can't be used in any way outside
the loop so it does not need to worry about saving them in ram in
case you jump out the loop.
2. helps others understand your code.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- Declaring local variables inside loop
- From: Hendrik Maryns
- Declaring local variables inside loop
- Prev by Date: Re: Declaring local variables inside loop
- Next by Date: Re: Declaring local variables inside loop
- Previous by thread: Re: Declaring local variables inside loop
- Next by thread: Re: Declaring local variables inside loop
- Index(es):
Relevant Pages
|