TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ALL
from: KROGG
date: 1998-03-25 20:07:00
subject: Subs vs gosub:which is fa

From: Krogg 
Subject: Subs vs gosub:which is faster
 
I have been constructing my own mode 13h library of sorts.I guess every
one knows the importance of speed in graphics routines.So far ive been
making a group of routines that i paste in at the bottom of my
program and use gosub's to access them.It sucks that way because
i have to set some varibles and then do the gosub like:
 
line_x1=10:line_y1=10:line_x2=20:line_y2=20:line_color=63
gosub draw_the_stupid_line
end
 
draw_the_stupid_line:
'[code for drawing line]
return
 
if i used a sub it would be easyier in many ways cause the code would look
sort of like this:
 
draw_the_stupid_line 10,10,20,20,63 '[x1,y1,x2,y2,color]
end
 
sub draw_the_stupid_line (x1 byval,y1 byval,x2 byval,y2 byval,col byval)
'[code for the line]
end sub
 
but which will execute faster?I heard that gosub was faster but having to
set the varibles must take a few cycles or so a piece,but im sure there is
some stuff involved in the varibles used by the sub as well.
which is faster?does anyone know?
 
--
                      THE
                  
        /\         \\     //         /\
       /  \         \\   //         /  \
      / /\/        /""""""\         \/\ \
     / /  SEE HIS (  /   \ \  SEE HIS  \ \
     \ \   FACE    \/ \/   SMILE   / /
      \ \          /   W   \          / /
       \ \        /\_|||||_/\        / /
       /  \      //   |||   \\      /  \
      / /\ \    //     '     \\    / /\ \
     / / / /      \ \ \ \
     \ \/  \_______________________/  \/ /
      \_________________________________/
         krogg.no.to.spam@inspace.net
          Remove no.to.spam to reply
 http://www.inspace.net/~carcher/krogg/aani.htm
  Gory javascript animations for your enjoyment
 
*** QwkNews (tm) v2.1
 * [TN71] Toast House Import
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.