Click to See Complete Forum and Search --> : C++ is only slighter faster than VB
made_of_asp
Jan 4th, 2002, 07:02 PM
Hello,
I used GetTickCount API and i found out that my two equal programs written on C++ and VB, had VB version was only 196 points slower than C++ and VB had window intilized while C++ was running in Console.
Is this realy true? I heard that C++ was much faster and efficient than VB :B :) :D
C Version (took 6783 points):
#include "stdafx.h"
#include <iostream.h>
#include <windows.h>
int main(int argc, char* argv[])
{
int x;
int ticks;
x = 5 * 8;
ticks = GetTickCount() / 1000;
cout << ticks;
cin >> x;
return 0;
}
VB Version:
Dim x As Integer
Dim ticks As Integer
x = 5 * 8
ticks = GetTickCount / 1000
Me.Caption = ticks
made_of_asp,
:rolleyes:
boscord
Jan 4th, 2002, 07:24 PM
Well, technically C++ is much faster than VB, but your example really doesnt prove it well. On small programs/functions, like the one you specified, the speed difference is relatively insignificant. But on much larger programs, VB can get to be a little bogged down and will run algorithms and long processes much slower because of various crap.
Here is a language comparisonC++ vs. Visual Basic (http://www.dummies.com/Technology/Programming/Programming_Fundamentals/0-7645-0835-0_0009.html)
Later
jim mcnamara
Jan 4th, 2002, 09:25 PM
Plus, none of his code is shwoing how long it took to execute
should be:
#include "stdafx.h"
#include <iostream.h>
#include <windows.h>
int main(int argc, char* argv[])
{
int x;
int ticks;
ticks=GetTickCount();
x = 5 * 8;
ticks -= GetTickCount();
cout << ticks;
cin >> x;
return 0;
}
[code]
[code]
Dim x As Integer
Dim ticks As Integer
Ticks = GetTickCount
x = 5 * 8
ticks = ticks -GetTickCount
Me.Caption = ticks
jim mcnamara
Jan 4th, 2002, 09:28 PM
While we are at it: On average C++ is an order of magnitude (10 times faster ) than VB code.
why? VB executes inside a virtual machine, just like java does in IE. It does not run as native image code.
made_of_asp
Jan 4th, 2002, 11:53 PM
10 times faster? You are kidding!
C++ is sooo hard :(
Tygur
Jan 5th, 2002, 02:28 AM
Originally posted by jim mcnamara
While we are at it: On average C++ is an order of magnitude (10 times faster ) than VB code.
why? VB executes inside a virtual machine, just like java does in IE. It does not run as native image code.
VB does not run inside a virtual machine when it is compiled to Native Code.
parksie
Jan 5th, 2002, 05:32 AM
That's one of the best solutions if the VB runtime dependencies aren't a problem.
It means you don't have to learn much of the API which takes quite a while to learn well.
Zaei
Jan 5th, 2002, 03:09 PM
Also, VB is all COM, which adds overhead as well.
Z.
kedaman
Jan 5th, 2002, 04:18 PM
WinAPI: bad paradigm
COM: performance hit
VB: very bad paradigm polluted slowmoving fat bastard
Zaei
Jan 5th, 2002, 04:32 PM
Originally posted by kedaman
WinAPI: bad paradigm
What are you going to do when you have to accomodate languages that arent OOP?
Z.
kedaman
Jan 5th, 2002, 08:17 PM
Originally posted by Zaei
What are you going to do when you have to accomodate languages that arent OOP?
Z.
Me or microsoft? :D microsoft is the one accomodating for function based languages, I'm for new innovations :)
parksie
Jan 6th, 2002, 04:05 AM
I'm doing the wrappers between the API and whatever you're using...in this case it's a functional->OOP layer.
I don't understand what Ked's doing at the moment :p
Zaei
Jan 6th, 2002, 10:13 AM
MS of course =).
Z.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.