Re: The inaugural VB6 vs dot net test
- From: "Mike Williams" <mikea@xxxxxxxxxxxxxxxxx>
- Date: Mon, 3 Dec 2007 11:42:26 -0000
"Michael C" <mike@xxxxxxxxxx> wrote in message news:OJ9pgUTNIHA.5140@xxxxxxxxxxxxxxxxxxxxxxx
There is no reason why the loop has to go in the same
direction as the bitmap processing. If you look at my
C# code the pointer is incremented seperate to the x
and y variables. I could make x and y count down to
zero without changing any other code. I could make
x count from 1000 to 2024 if I wanted. :-) Just
increment a third variable inside the inner loop.
Yes, I already know that, Michael. And what is more, you obviously already know that I do. But I was repsonding to Ulrich's statement about counting down to zero as opposed to counting up to a specific value in order to save a couple of clock cycles. WTF is the point of doing that if you are then going to include and additional otherwise unnecessary pointer that gets incremented within the loop, which will eat up as least as many clock cycles as you saved, thereby negating your efforts!
When using a 2D array VB must do a "pointer = base + x + y * linewidth" which will be hugely
slower than "inc pointer".
I agree entirely with that, and it is a very good suggestion, and it should speed things up a little. But that is not what I was talking about in my response to Ulrich, as I think you already know. I was specifically responding to Ulrich's statement when he said:
"In my opinion the reason why one could hope that
counting down to 0 makes loops running faster comes
from how the compiler handles those loops".
I wanted him to know that doing so would not in fact save any time at all in this particular case, and that it would in fact make the code run very much slower because doing that (and doing /only/ that) would cause the memory to be accessed in a fashion that failed to take full advantage of the memory cache, a subject which Ulrich did not even mention and which it appeared he did not know about. And of course fixing the "memory cache" problem by adding an additional counter within the loop would negate everything that you gained by your act of counting down to zero instead of counting up.
I really do wish people would read what I post instead of just "coming at me" for reasons that often do not seem to have anything to do with what I actually said, reaosns that I suspect are often more to do with the fact that they just want to wind me up! Ulrich is beginning to fall into that category as well now.
Mike
.
- Follow-Ups:
- Re: The inaugural VB6 vs dot net test
- From: Michael C
- Re: The inaugural VB6 vs dot net test
- References:
- Re: The inaugural VB6 vs dot net test
- From: Ulrich Korndoerfer
- Re: The inaugural VB6 vs dot net test
- From: Ulrich Korndoerfer
- Re: The inaugural VB6 vs dot net test
- From: Mike Williams
- Re: The inaugural VB6 vs dot net test
- From: Ulrich Korndoerfer
- Re: The inaugural VB6 vs dot net test
- From: Mike Williams
- Re: The inaugural VB6 vs dot net test
- From: Michael C
- Re: The inaugural VB6 vs dot net test
- Prev by Date: Re: alternative to gettickcount
- Next by Date: Re: The inaugural VB6 vs dot net test
- Previous by thread: Re: The inaugural VB6 vs dot net test
- Next by thread: Re: The inaugural VB6 vs dot net test
- Index(es):
Relevant Pages
|