Gosub or procedures for game development?

Advanced game related topics
yabune
User
User
Posts: 65
Joined: Mon Aug 22, 2005 2:31 pm

Gosub or procedures for game development?

Post by yabune »

Is there any difference between gosub and procedures in terms of speed?
I want to create a game and I noticed in Waponez II example, the game is structured with gosubs.

thanks!
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Procedures have some overhead (i.e clearing local vars etc) so it'll probably be faster with gosubs, but i think readability will suffer alot if you go the GOSUB way. If i were you i would use procedures if the project is going to be larger than Waponez, for smaller programs it doesn't really matter.
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

I don think there can be much difference, I allways use procedures since I think it's more readable.
I like logic, hence I dislike humans but love computers.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

go for the most readable version on good hardware

once you're done, you can then optimize your code for worse hardware

or code on mid range hardware

by the time your program is finished the hardware is so much faster that it won't matter :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply