So, the times look identical. That's cool!
EDIT: Hope you saw David's post from 10 minutes before...
Printable View
So, the times look identical. That's cool!
EDIT: Hope you saw David's post from 10 minutes before...
Ooops nope ...Quote:
Originally Posted by dglienna
Acctually now the PM i got makes a little more sence ...
Add that code to the vb6 side and run the test again, if you get time.
That's really interesting Gremmy! Since the execution times seem to be going down for each revision in the program, how about trying it with the TextBox value at 2 rather than 3, or make the form larger? The longer the execution time, the better we can see the differences.
TheCPUWizard: As far as I can see, the only thing that could be added (with those two lines you've referred to) is to pick up the return from FrameRect. If it was to fail, the only thing that would happen is the rectangle wouldn't get drawn. The variables passed are of the same type, and it doesn't care what values they are. The RGB() function would raise an error if the values were out of range, which is why I used Mod - restricting the range to valid values.
I was wanting to run some tests myself but can't seem to find the VB6 code that is being used. Could someone point me to it... please :rolleyes:
However, because you are using "mod" (which is a signed calculation), the performance is significantly lower (at least for .NET) than if you used "and".
See the difference?Code:Dim red As Integer = X1 Mod 256
00000118 mov edx,ebx
0000011a and edx,800000FFh
00000120 jns 0000012A
00000122 dec edx
00000123 or edx,0FFFFFF00h
00000129 inc edx
Dim green As Integer = Y1 Mod 256
0000012a mov eax,edi
0000012c and eax,800000FFh
00000131 jns 0000013A
00000133 dec eax
00000134 or eax,0FFFFFF00h
00000139 inc eax
Dim blue As Integer = (X1 + Y1) Mod 256
0000013a mov ecx,ebx
0000013c add ecx,edi
0000013e jo 00000219
00000144 and ecx,800000FFh
0000014a jns 00000154
0000014c dec ecx
0000014d or ecx,0FFFFFF00h
00000153 inc ecx
00000154 push eax
00000155 push ecx
00000156 lea ecx,[ebp-68h]
00000159 call 778D94E0
0000015e lea eax,[ebp-68h]
00000161 push dword ptr [eax+0Ch]
00000164 push dword ptr [eax+8]
00000167 push dword ptr [eax+4]
0000016a push dword ptr [eax]
0000016c mov ecx,esi
0000016e cmp dword ptr [ecx],ecx
00000170 call 7799CF58
=========================
REM Dim c As New Pen(Color.FromArgb(X1 Mod 256, Y1 Mod 256, (X1 + Y1) Mod 256))
Dim red As Integer = (X1 And 255)
00000114 mov edx,ebx
00000116 and edx,0FFh
Dim green As Integer = (Y1 And 255)
0000011c mov ecx,edi
0000011e and ecx,0FFh
Dim blue As Integer = ((X1 + Y1) And 255)
00000124 mov eax,ebx
00000126 add eax,edi
00000128 jo 00000206
0000012e and eax,0FFh
c.Color = Color.FromArgb(red, green, blue)
00000133 push ecx
00000134 push eax
00000135 lea ecx,[ebp-6Ch]
00000138 call 778D94E0
0000013d lea eax,[ebp-6Ch]
00000140 push dword ptr [eax+0Ch]
00000143 push dword ptr [eax+8]
00000146 push dword ptr [eax+4]
00000149 push dword ptr [eax]
0000014b mov ecx,esi
0000014d cmp dword ptr [ecx],ecx
0000014f call 7799CF58
Okay at '2' the time difference creeps to 'NET now.
Full screen size (1280 * 768) test..
VB6 = 1232ms
VB.NET = 1092ms (with build or in debug) ..
HOWEVER, there is one fundamental difference that has crept in, with a value of 1, vb6 gives a fine color spectrum, in .NET i get grey.
and it comes down to these two linesANDCode:VB6
SetRect Rct, X1, Y1, X1 + Y2, Y1 + Y2
SetRect uses Top, Left, Bottom, Right for input....Code:VB.NET
BufferGObj.DrawRectangle(c, X1, Y1, Y2 - 1, Y2 - 1)
DrawRect uses Top, Left, Height, Width for input....
SetRect can accept inputs that essentially gives you a rect that is 0 width, however DrawRect will do nothing if the rect is 0 width..
fundamental differences in implimentation ?????
It cannot use And, because the values have to "cycle around". That is, a value of 257 results in a value of 1.
Never expected that DrawRectange wouldn't draw even when the API can do it. Are there any other functions that you could use to get equivalent output?
I'm not sure if I am using the right files or not but I am seeing a huge difference between VB6 and dot net on this pc.
VB6 Code running at an average of 300
Dot Net 2005 avg 2230
Both running 1280x768 set to 3 on a X2 4400+ 2g 7300GT
The file is attached to post 279.Quote:
Originally Posted by WillAtwell
Hmmm this does offer a new perspective. with the 'AND' instead of 'Mod', the previous test (at '3') the .NET time droped to 110ms and full screen at '2' droped to 1060ms..Quote:
Originally Posted by TheCPUWizard
Hmm Wiz, i think you may be up late..Quote:
Originally Posted by WizBang
257 AND 255 = 1
257 MOD 256 = 1
Dbl checked it too ..
Ooops...you're right Gremmy...I was still using 256 instead of 255.
<EDIT>
Just tried it, and didn't see a lot of difference. What do you get for the comparison with this Gremmy?
Just tested on another computer. This time running the exe files without the designers loaded. Last tests were with both designers running during the test and in debug mode. I also did 2 builds of the dot net exe one under VS2005 and one under VS2008
Set at 2 seems to be the lowest setting that still gives us some color on the dot net exe.
VB6 453
VB2005 593
VB2008 593
These tests at 1280x768 on a E7200 @3.0438gHz 2g 9600GT