Prompted by the differences between how Visual Studio 2005 handles designer generated code in Visual Basic and C# in this post, a conversation of what was hidden in VB versus C# versus IL versus Assembly began followed by a debate as to whether it was a good thing that so much information be hidden from VB developers and your opinions on it. This is a continuation of that conversation and debate.
******
Marble_eater, technically, at least in the C++/Assembly world, everything reduces down to do-while loops. Loop performance is going to be affected by a number of factors including but not limited to function calls within a loop (as you said) but also paging/memory use and how you access your data. As I understand, the .Net compiler does a pretty good job of optimizing loops through techniques such as loop unrolling and in-lining some methods, but as your experiment shows, there is still a significant hit in the overhead of declaring and using an iterator. Is this really a deal breaker? I guess the answer is that it depends. All I have to say is Moore's law, how often do you deal with 100,000,000 entries in an ArrayList, and I would hope a person in a sitution needing that much speed would know a thing or two about programming and how a computer works.
For the, initial target audience of VB, I think it is 100% unnecessary to know this information and it would just get in the way of the purpose of VB -- to make it easy to quickly crank out great software. Delegates and event binding get in the way. Designer code gets in the way. Lack of foreach gets in the way. For that matter, pointers and memory management get in the way.
Just remember that every tool in the tool box has a purpose (otherwise I hope it wouldn't be in your toolbox!), but every craftsman always has their favorites.
******
Marble_eater, technically, at least in the C++/Assembly world, everything reduces down to do-while loops. Loop performance is going to be affected by a number of factors including but not limited to function calls within a loop (as you said) but also paging/memory use and how you access your data. As I understand, the .Net compiler does a pretty good job of optimizing loops through techniques such as loop unrolling and in-lining some methods, but as your experiment shows, there is still a significant hit in the overhead of declaring and using an iterator. Is this really a deal breaker? I guess the answer is that it depends. All I have to say is Moore's law, how often do you deal with 100,000,000 entries in an ArrayList, and I would hope a person in a sitution needing that much speed would know a thing or two about programming and how a computer works.
For the, initial target audience of VB, I think it is 100% unnecessary to know this information and it would just get in the way of the purpose of VB -- to make it easy to quickly crank out great software. Delegates and event binding get in the way. Designer code gets in the way. Lack of foreach gets in the way. For that matter, pointers and memory management get in the way.
Just remember that every tool in the tool box has a purpose (otherwise I hope it wouldn't be in your toolbox!), but every craftsman always has their favorites.