Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Comparison

Author
Message
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 8th Mar 2003 08:52
I'm a little wary on this so I'm going to ask before I start getting into bad habits. In which situation would you use Gosub and Functions? In the on-site tutorials they use Gosub where I would naturally put a function in other languages. So just wondering when you would use functions (other then to return a value)?

Similarly, what are the advantages of using .x models over .3ds or vice versa? Thanks =)
"Computers are useless they can only give you answers."
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 8th Mar 2003 10:22
there is a slight speed difference between functions and gosubs.

I think gosubs are slightly faster.

I prefer functions but ill use a gosub if
1: I need a bit of extra speed.
2: I dont need to return a value like a function
3: If im looking at someones code with them in
4: I want to neaten up the structure into blocks


I wrote a lengthy functions tutorial on RGT forum if u want to browse to it.


3ds files are smaller in size but take a while longer to load as they are transfered to x files on the fly

x files are larger in filesize but are quicker to load.

3ds file import export is common

x file importing isnt so common

both support a form of keyframe animations

Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 8th Mar 2003 12:18
Aaah, thanks for that. I guess gosub also has the advantage of using goto incase you don't want to jump back up, I don't think functions can do that though.

"Computers are useless they can only give you answers."
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 8th Mar 2003 14:33
GOSUB is indeed faster in DBPro.

On my PC (850Mhz P3) in 100,000,000 loops, a gosub to an empty subroutine took 3600ms while an empty function took 4500ms. So thats a difference of 0.000000036 to 0.000000045 for a single call ... is that really a reason to choose gosub over function calls?

Functions don't have to return values.

Functions are natural blocks of code already.

Sorry to disagree Indi. Of course, in Classic, gosubs are far faster than functions.

Login to post a reply

Server time is: 2024-09-19 22:35:59
Your offset time is: 2024-09-19 22:35:59