Cor,
I know what you are stating, but I am not quite sure why you are
stating it. I am not debating whether VB.NET or C/C++ is a better
development language. I simply wanted confirmation on a published
Microsoft recommendation. They spent time and resources on publishing
it, so it must have been for a reason.
Given a VB.NET application that executes as a batch process with code
that executes repeatedly, I would be willing to make code changes that
saves fractions of seconds in a single procedure.
So, based on the link I provided, which actually executes in less
time?
Example 1:
Public Sub Test1(ByRef val As Long)
val += 1
Return
End Sub
Example 2:
Public Sub Test2(ByRef val As Long)
val += 1
End Sub
According to the link, Example 1 is more efficient. My point is that
if this is true, I think it's a defect in the compilation. There
should be absolutely no difference between the two.
Here's a bit more code to put this into perspective:
Public Sub Main()
Dim start1 As Date
Dim finish1 As Date
Dim start2 As Date
Dim finish2 As Date
start1 = Now
For i As Long = 0L To 10000000000L
Call Test1(i)
Next i
finish1 = Now
start2 = Now
For i As Long = 0L To 10000000000L
Call Test2(i)
Next i
finish2 = Now
Call MsgBox(String.Format("Test1: {0} ms Test2: {1} ms", _
finish1.Subtract(start1).TotalMilliseconds, _
finish2.Subtract(start2).TotalMilliseconds))
Executing this test, I received a savings of over one second. There
is a difference in time, and the MSDN article is accurate with Visual
Studio 2005 containing the latest service packs.
On Wed, 8 Aug 2007 19:39:04 +0200, "Cor Ligthert[MVP]"
<notmyfirstname@planet.nlwrote:
Quote:
>Jamil,
>
>Remember that all external actions like a .show cost more time than all
>other actions from an application. With this you almost in any situation for
>sure can not make your program faster for your user.
>
>(There are some application when you can win time, however then the question
>comes if the managed code based programs are the best for that. In those
>situation can C++ be a good choise). Know that it should be very extreme, we
>have seen a real live big sample of an application in this newsgroup where
>the VB.Net program had more performance than the same applications in C++.
>
>Cor