[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Basic compiler
In article <CYidna_JF5Yo8KPY4p2dnA@telenor.com>,
Knut Roll-Lund <kr-lund@nogarbage.online.no> wrote:
> Michael J. Mahon wrote:
>
>> In Applesoft, constants are represented in ASCII in the program
>> text and converted on each use. This is why assigning a frequently
>> used constant to a variable speeds up a program.
>
> Yes A=1:B=A is faster than A=1:B=1
...and A=1:B=1 is faster than A=1.00000000:B=1.00000000 :-)
Btw whether B=A is faster than B=1 may depend on how many variables your
program has. The "=A" require a lookup of the variable A. IF your program
has few variables (as small test programs tend to have), B=A is definitely
faster than B=1. But if your program has a large number of variables,
then B=A may be slower, depending on where in the list of variables A
happens to reside.
--
----------------------------------------------------------------
Paul Schlyter, Grev Turegatan 40, SE-114 38 Stockholm, SWEDEN
e-mail: pausch at stockholm dot bostream dot se
WWW: http://stjarnhimlen.se/