Re: [PATCH] speed: reuse char instead of recreation in loop

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Daniel Barkalow
Date: Monday, May 25, 2009 - 3:08 pm

On Mon, 25 May 2009, Thomas Spura wrote:


Actually, having the variables go out of scope should be at least as fast. 
The compiler doesn't actually do anything to make the old variable
inaccessible and get a new variable; with the variable uninitialized, it's 
legitimate for the compiler to simply reuse the same storage for all 
iterations. Futhermore, with the variables declared inside the loop, the 
compiler is allowed to make optimizations that would fail to preserve 
those variables between iterations. There are probably no such 
optimizations in this code for it to make, but, in general, letting 
variables in loops go out of scope (in C) only improves optimization 
possibilities.

	-Daniel
*This .sig left intentionally blank*
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] speed: reuse char instead of recreation in loop, Thomas Spura, (Mon May 25, 12:44 pm)
Re: [PATCH] speed: reuse char instead of recreation in loop, =?iso-8859-1?Q?Bj=F6 ..., (Mon May 25, 1:16 pm)
Re: [PATCH] speed: reuse char instead of recreation in loop, =?UTF-8?B?UmVuw6kgU2 ..., (Mon May 25, 1:39 pm)
Re: [PATCH] speed: reuse char instead of recreation in loop, Daniel Barkalow, (Mon May 25, 3:08 pm)
Re: [PATCH] speed: reuse char instead of recreation in loop, Stephen R. van den Berg, (Tue May 26, 4:54 am)