[7.44] Local Subroutines Execute Faster Than Global Subroutines - Texas Instruments TI-89 Tip List

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

[7.44] Local subroutines execute faster than global subroutines

TI Basic subroutines can be defined outside of the calling routine (an global subprogram), or they can
be defined within the calling routine (a local subprogram). As an example, this program t() calls the
external function sub1():
t()
Prgm
Local k,r
For k,1,500
sub1(k)→r
EndFor
EndPrgm
sub1(x)
Func
Return x^2
EndFunc
sub1() would be defined locally in t() like this:
t()
Prgm
Local k,r,sub1
Define sub1(x)=Func
Return x^2
EndFunc
For k,1,500
sub1(k)→r
EndFor
EndPrgm
Local subroutine calls are slightly faster, as this table shows.
Mean matrix element access time, indirect access
Matrix
Matrix
Row
Columns
5
25
5
105
5
145
10
40
10
70
15
15
25
5
25
25
40
10
70
10
105
5
145
5
Table 4
Mean acces time,
single element (mS)
23.8
32.6
36.9
30.4
36.4
27.2
24.9
35.2
31.3
38.7
36.3
42.1
Global
Local
Indirect access
overhead (mS)
5.0
5.6
5.6
5.5
5.3
6.6
5.8
5.8
6.2
5.8
5.7
5.7
7 - 52

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92+

Table of Contents