Thread: VB Speed compared to VC++ Speed.

  1. #1
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719

    VB Speed compared to VC++ Speed.

    I was curious tonight to find a Relative speed difference between Visual Basic and Visual C++. So I recorded the Second and Millisecond before and after the operation of adding 1 to a Long 1 million times.

    Visual Basic took 230-260 Milliseconds to do this.
    Visual C++ took 10 Milliseconds to do this.

    So Visual C++ is at relatively 26x faster then Visual Basic in just adding Integeres together.

    I thought that some people might find this information... interesting.

    The machine that it was tested on was an AMD K6 550Mhz, Slot A. 192 MB of SDRAM 100Mhz.
    Last edited by Xei; 05-17-2002 at 11:28 PM.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    This is true. But not a perfect test, because adding two integers in VB is not the same as adding two integers in VC. VB does overflow checks, that is when you add two integers in VB that would be larger than an integer together, it will throw an exception. In VC, it will simply let the value of the result overflow.

    In general, for computing, C is much faster than VB, maybe 10 times average. That is partly because VB itself is slow, but also because it has security precautions build in that C programmers have to build themselves ( and simply omit for those comparisons ).
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    Okay, I'll cancel overflow checks. Its a compile options. Thanks for bringing it up, I didn't even think about that.
    Last edited by Xei; 05-18-2002 at 09:34 AM.

  4. #4
    Registered User
    Join Date
    May 2002
    Posts
    63
    My lecturer told me something to do with the fact that BASIC runs line for line at runtime, and a C++ program is compiled top-down, in this fashion, therefore when it is run the program will run reletively faster than that of a program which does exactly the samething in BASIC.

    But BASIC is generally used by proffesionals to give examples of their work

    Just a thought...
    tudehopet uses Borland Compiler 5.5
    and Visual C++ 6.

  5. #5
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    My lecturer told me something to do with the fact that BASIC runs line for line at runtime, and a C++ program is compiled top-down
    While this is pretty common for many Basic implementations (not VB for a while), it is not something defined by a particaular language. You could create an "interpreted C++" rather than a compiled one if you really wanted.

  6. #6
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    When something is compiled then the Execution is actually... compiled. Its not a script. However in TI-83 Calculators for example an ASM/FLASH application will be faster because the Basic Code for the calculators is compiled into ASM then executed line by line.

  7. #7
    In The Light
    Join Date
    Oct 2001
    Posts
    598
    howdy,
    very interesting...
    i have heard the difference is only 2%.

    M.R.
    I don't like you very much. Please post a lot less.
    Cheez
    *and then*
    No, I know you were joking. My point still stands.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Flight Simulator Wind Speed!!
    By Dilmerv in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2006, 12:40 AM
  2. VB compared to C++
    By C+noob in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 07-14-2005, 01:29 AM
  3. Passing an Array of Strings from VB to a C DLL
    By mr_nice! in forum Windows Programming
    Replies: 9
    Last Post: 03-08-2005, 06:16 AM
  4. Hai Everybody !VC dll in VB ?
    By samudrala_99 in forum Windows Programming
    Replies: 2
    Last Post: 06-20-2003, 07:22 AM
  5. Passing parameters from VB to C++ through ActiveX DLL
    By torbjorn in forum Windows Programming
    Replies: 0
    Last Post: 12-10-2002, 03:13 AM