Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About Hosting and VB it selfs
#1
Hi all! I did a very amazing test with VB and C++, comparing both. I want to change all my code to C++ couse everybody says it is faster, and it is. I developed a DLL with 2 Sum functions, one that uses 2'byval's, 'a' and 'b' variables and the other uses 'byref', 'S' as a structure(type) that has a 'a' and 'b' vars. I did the same functions inside VB, and tested both thru VB, so I just compiled the DLL and used it's functions thru VB. Then I F5 inside VB and realized that C's DLL was much faster, almost 2X faster than VB's. Then I compiled the VB project and executed the exe file. Then I noticed a VERY IMPORTANT THING! VB was faster that time! And almost 2X faster than C's DLL. I tought I did something wrong and noticed that I didn't. It realy was the great VB acting again... When the VB code was 'ran' using F5 it got MUCH MUCH slower than the SAME compiled code! So I'm warning you to don't host your server thru 'ran' VB code for peaple. First compile the code and then execute the exe file. I'll do a few more tests w/ the same functions being used from C++, and not VB, to see if C++ is realy much faster then VB.

It's just a warning becouse I used to do that when the server was bugued, I used to run the server thru VB and then wait until it bugs so I can fix. Don't do that! xD
Reply
#2
So have you found anything else about this yet or are you still working on it?

Lord, it's know, not now. There is a big difference. Know is like "no". Now, is like.. Well, now. Lol.

Good luck with all of this DM. Hope you come to a conclusion as to which lang is the better.
Reply
#3
Uncompiled code is always going to be tons slower then compiled.

What compiling options are you using in VB? In C++? You might want to make sure you choose the best speed optimizations for both.

Also, many C++ functions are faster when written correctly because there is less overhead and there is more to it. People seem to leave that out. VB doesn't just make slower code since it hates you, it has slower code since it has error checks and such.

Either way, in a properly coded game, you wont hardly notice the difference since most of your CPU cycles go to outside libraries (sound, music, and most importantly, graphics).

Quote:It's just a warning becouse I used to do that when the server was bugued, I used to run the server thru VB and then wait until it bugs so I can fix. Don't do that! xD

Yeah many people don't seem to understand that its different or something. Its a REALLY good feature to be able to do that for debugging, but in a public server, a horrible idea. 8)
Reply
#4
I did the same test w/ C++, direticly from it, no DLL. It was pretty much faster!
Verrigan told me about VB's compiling stuff and I made it much faster, selecting that options, but it stills slower than C++.
I used a simple sum function, I dont think there is a way to make sum faster. If there is, tell me ^^
I'll post in a few minutes the times I get on my computer.

EDIT:
All tests were are like this:
start count
for i = 1 to 10^6
tmp=sum(i,i)
next i
tells me the time lapsed, in miliseconds.

I tried the 2 types of sending the values, ByVal and ByRef, for VB and C++, so I'll show you both results. All resulst are the best one I could get on my computer.

Thru VB:
VBFunction(ByVal): 63
VBFunction(ByRef): 78
C++Function(DLL,ByVal): 125
C++Function(DLL,ByRef): 141

Thru C++:
C++Function(ByVal): 31
C++Function(ByRef): 46

This tests showed me that C++ was much faster than VB in all cases.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)