Click here to Skip to main content
14,270,447 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life. Technical discussions are encouraged, but click here to ask your programming questions.

The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct, no programming questions and please don't post ads.
 
GeneralRe: Using IEnumerable nonsense for everything Pin
F-ES Sitecore19-Jul-16 2:50
mveF-ES Sitecore19-Jul-16 2:50 
GeneralRe: Using IEnumerable nonsense for everything Pin
Richard Deeming19-Jul-16 2:54
mveRichard Deeming19-Jul-16 2:54 
GeneralRe: Using IEnumerable nonsense for everything Pin
F-ES Sitecore19-Jul-16 3:17
mveF-ES Sitecore19-Jul-16 3:17 
GeneralRe: Using IEnumerable nonsense for everything Pin
Richard Deeming19-Jul-16 3:21
mveRichard Deeming19-Jul-16 3:21 
GeneralRe: Using IEnumerable nonsense for everything Pin
F-ES Sitecore19-Jul-16 3:26
mveF-ES Sitecore19-Jul-16 3:26 
GeneralRe: Using IEnumerable nonsense for everything Pin
James Curran18-Jul-16 4:26
memberJames Curran18-Jul-16 4:26 
GeneralRe: Using IEnumerable nonsense for everything Pin
Mike Marynowski18-Jul-16 7:31
professionalMike Marynowski18-Jul-16 7:31 
GeneralRe: Using IEnumerable nonsense for everything Pin
James Curran18-Jul-16 8:10
memberJames Curran18-Jul-16 8:10 
Optimization largely depends on tracking the lifetime of variables:
for(int i =0; i< 100; ++i)
 {...}

will be better optimized, than this...
int i;
for(i =0; i< 100; ++i)
 {...}

just because the compiler knows that "i" is never used again outside that for loop. In the latter, space must be allocated for i on the stack, and it must be stored there. In the first, "i" may live at it's entire existence in a register.

Now, in an example as small as the above, a good compiler may still realize that even the second "i" is not used again, but the larger that function gets, with more things to track, the optimizer begin to give up.
Truth,

James

GeneralRe: Using IEnumerable nonsense for everything Pin
Mike Marynowski18-Jul-16 8:16
professionalMike Marynowski18-Jul-16 8:16 
GeneralRe: Using IEnumerable nonsense for everything Pin
James Curran19-Jul-16 4:00
memberJames Curran19-Jul-16 4:00 
GeneralRe: Using IEnumerable nonsense for everything Pin
Mike Marynowski19-Jul-16 7:24
professionalMike Marynowski19-Jul-16 7:24 
GeneralRe: Using IEnumerable nonsense for everything Pin
F-ES Sitecore18-Jul-16 22:33
mveF-ES Sitecore18-Jul-16 22:33 
GeneralRe: Using IEnumerable nonsense for everything Pin
Mike Marynowski18-Jul-16 22:41
professionalMike Marynowski18-Jul-16 22:41 
GeneralRe: Using IEnumerable nonsense for everything Pin
Richard Deeming19-Jul-16 2:41
mveRichard Deeming19-Jul-16 2:41 
AnswerRe: Using IEnumerable nonsense for everything Pin
Clifford Nelson18-Jul-16 6:43
mvaClifford Nelson18-Jul-16 6:43 
GeneralRe: Using IEnumerable nonsense for everything Pin
OriginalGriff16-Jul-16 6:03
protectorOriginalGriff16-Jul-16 6:03 
GeneralRe: Using IEnumerable nonsense for everything Pin
harold aptroot16-Jul-16 6:10
memberharold aptroot16-Jul-16 6:10 
GeneralRe: Using IEnumerable nonsense for everything Pin
OriginalGriff16-Jul-16 6:33
protectorOriginalGriff16-Jul-16 6:33 
GeneralRe: Using IEnumerable nonsense for everything Pin
harold aptroot16-Jul-16 6:39
memberharold aptroot16-Jul-16 6:39 
GeneralRe: Using IEnumerable nonsense for everything Pin
Sentenryu18-Jul-16 0:03
memberSentenryu18-Jul-16 0:03 
GeneralRe: Using IEnumerable nonsense for everything Pin
harold aptroot18-Jul-16 0:54
memberharold aptroot18-Jul-16 0:54 
GeneralRe: Using IEnumerable nonsense for everything Pin
Sentenryu18-Jul-16 2:00
memberSentenryu18-Jul-16 2:00 
GeneralRe: Using IEnumerable nonsense for everything Pin
harold aptroot18-Jul-16 2:08
memberharold aptroot18-Jul-16 2:08 
GeneralRe: Using IEnumerable nonsense for everything Pin
Sentenryu18-Jul-16 2:42
memberSentenryu18-Jul-16 2:42 
GeneralRe: Using IEnumerable nonsense for everything Pin
jfren48418-Jul-16 3:31
memberjfren48418-Jul-16 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.