|
-
Jan 4th, 2002, 08:02 PM
#1
Thread Starter
Hyperactive Member
C++ is only slighter faster than VB
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 
C Version (took 6783 points):
PHP Code:
#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:
VB Code:
Dim x As Integer
Dim ticks As Integer
x = 5 * 8
ticks = GetTickCount / 1000
Me.Caption = ticks
made_of_asp,
-
Jan 4th, 2002, 08:24 PM
#2
Lively Member
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
Later
Last edited by boscord; Jan 4th, 2002 at 08:31 PM.
-
Jan 4th, 2002, 10:25 PM
#3
Plus, none of his code is shwoing how long it took to execute
should be:
[code]
#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
-
Jan 4th, 2002, 10:28 PM
#4
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.
-
Jan 5th, 2002, 12:53 AM
#5
Thread Starter
Hyperactive Member
10 times faster? You are kidding!
C++ is sooo hard
-
Jan 5th, 2002, 03:28 AM
#6
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.
-
Jan 5th, 2002, 06:32 AM
#7
Monday Morning Lunatic
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.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jan 5th, 2002, 04:09 PM
#8
Also, VB is all COM, which adds overhead as well.
Z.
-
Jan 5th, 2002, 05:18 PM
#9
transcendental analytic
WinAPI: bad paradigm
COM: performance hit
VB: very bad paradigm polluted slowmoving fat bastard
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jan 5th, 2002, 05:32 PM
#10
Originally posted by kedaman
WinAPI: bad paradigm
What are you going to do when you have to accomodate languages that arent OOP?
Z.
-
Jan 5th, 2002, 09:17 PM
#11
transcendental analytic
Originally posted by Zaei
What are you going to do when you have to accomodate languages that arent OOP?
Z.
Me or microsoft? microsoft is the one accomodating for function based languages, I'm for new innovations
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jan 6th, 2002, 05:05 AM
#12
Monday Morning Lunatic
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
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jan 6th, 2002, 11:13 AM
#13
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|