Solved

Visual Basic reference

Posted on 2004-10-13
3
404 Views
Last Modified: 2010-04-24
I just found an interesting quote in a coding guidelines documents:

"Remove the Visual Basic reference from your project. Making use of the original Visual Basic functions has been proven to be up to 1000 times slower than the .NET counterparts; you have been warned."

Do you agree with this quote?

Do you have proof of that?
0
Comment
Question by:Éric Moreau
3 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 62 total points
Comment Utility
I never noticed that and I find it very convenient to use VB functions sometimes. Maybe it is slower. It depends on what you are doing. Will it bother you if instead 0.00001 sec the process will finish in 0.01 sec?
0
 
LVL 25

Assisted Solution

by:RonaldBiemans
RonaldBiemans earned 63 total points
Comment Utility
Well, I actually run a small test using the old mid function and the new substring method and there is indeed a difference.

But like Iboutchkine said it is pretty neclectable (when I run it 1,000,000 times the biggest difference is 30 milliseconds).

As you can see in the result below the .net way is always faster then the old method (although sometimes there equal in speed)

Dim s As String = "hallohallohallohallohallohallohallohallohallohallohallohallohallohallohallohallohallohallohallo"
        Dim ss As String
        Dim dd As Integer

        For i As Integer = 0 To 10
            Dim test As Integer = Environment.TickCount
            For x As Int32 = 0 To 1000000
                ss = s.Substring(1, 15)
            Next
            Console.WriteLine(Environment.TickCount - test)

            Dim test2 As Integer = Environment.TickCount
            For x As Int32 = 0 To 1000000
                ss = Mid(s, 1, 15)
            Next

            Console.WriteLine(Environment.TickCount - test2)
        Next

this was the result

125
141
125
125
109
141
109
125
125
125
110
125
109
141
109
125
110
140
110
125
109
125
0
 
LVL 69

Author Comment

by:Éric Moreau
Comment Utility
It is not really convincing!!!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now