diff options
Diffstat (limited to 'ossintbas.7')
-rw-r--r-- | ossintbas.7 | 218 |
1 files changed, 210 insertions, 8 deletions
diff --git a/ossintbas.7 b/ossintbas.7 index 19cbc3a..dda00d3 100644 --- a/ossintbas.7 +++ b/ossintbas.7 @@ -43,12 +43,7 @@ BASIC XL/XE here, as I discover them. For more info on the release: .INDENT 0.0 .INDENT 3.5 -.sp -.nf -.ft C -https://forums.atariage.com/topic/257029\-oss\-d\-day\-part\-3\-integer\-basic\-source\-code\-now\-in\-pd/ -.ft P -.fi +\fI\%https://forums.atariage.com/topic/257029\-oss\-d\-day\-part\-3\-integer\-basic\-source\-code\-now\-in\-pd/\fP .UNINDENT .UNINDENT .SH NUMERICS @@ -91,7 +86,7 @@ Abbreviation: \fBV.\fP .INDENT 0.0 .INDENT 3.5 Increment (add 1 to) a variable. This is about 30% faster than -\fBA=A+1\fP\&. Abbreviate as \fBVD.\fP\&. +\fBA=A+1\fP\&. .sp Abbreviation: \fBVI.\fP .UNINDENT @@ -100,7 +95,7 @@ Abbreviation: \fBVI.\fP \fBVDEC\fP \fI<var>\fP .INDENT 0.0 .INDENT 3.5 -Decrement (subtract 1 from) a variable. Abbreviate as \fBVD.\fP\&. +Decrement (subtract 1 from) a variable. Faster than \fBA=A\-1\fP\&. .sp Abbreviation: \fBVD.\fP .UNINDENT @@ -264,6 +259,213 @@ be used as array variable names, if you wish. .B \fBUSING\fP BASIC XL and XE\(aqs "PRINT USING" doesn\(aqt exist in Integer BASIC. .UNINDENT +.SH PERFORMANCE +.sp +OSS Integer BASIC is \fIfast\fP, compared to other interpreted BASICs on +the Atari. It even outperforms Turbo BASIC XL (though, not \fIcompiled\fP +Turbo). +.sp +For testing, I used a modified version of the Sieve of Eratosthenes +program, found in the source for \fBbas55\fP\&. The program finds and +prints all the prime numbers between 2 and 1000. The code: +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +10 POKE 18,0:POKE 19,0:POKE 20,0 +20 DIM A(1000) +30 N=1000 +100 S=SQR(N) +110 FOR I=2 TO S +120 IF A(I)=1 THEN 170 +130 D=N/I +140 FOR J=I TO D +150 A(I*J)=1 +160 NEXT J +170 NEXT I +180 FOR I=2 TO N +190 IF A(I)=1 THEN 210 +200 PRINT I +210 NEXT I +1000 PRINT PEEK(18)*256*256+PEEK(19)*256+PEEK(20) +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Line 1000 prints how many jiffies the program took to run. I used +Atari800 5.2.0 emulating an NTSC Atari 800XL, so one jiffy is 1/60 of +a second. The "Fastchip" results use Charles Marslet\(aqs OS floating +point replacement ROM. For Integer BASIC, BASIC XL and BASIC XE, +separate runs were done with the line \fB5 FAST\fP at the start of the +program. Results: +.TS +center; +|l|l|l|. +_ +T{ +BASIC +T} T{ +Jiffies +T} T{ +Speedup +T} +_ +T{ +Atari 8K +T} T{ +1867 +T} T{ +\-\- +T} +_ +T{ +A+ +T} T{ +1671 +T} T{ +1.12 +T} +_ +T{ +Atari 8K (Fastchip) +T} T{ +1587 +T} T{ +1.18 +T} +_ +T{ +A+ (Fastchip) +T} T{ +1569 +T} T{ +1.19 +T} +_ +T{ +XE +T} T{ +1440 +T} T{ +1.3 +T} +_ +T{ +AMSB2 +T} T{ +1518 +T} T{ +1.23 +T} +_ +T{ +XL +T} T{ +1270 +T} T{ +1.47 +T} +_ +T{ +Altirra +T} T{ +1166 +T} T{ +1.67 +T} +_ +T{ +XL (FAST) +T} T{ +1110 +T} T{ +1.68 +T} +_ +T{ +XL (Fastchip) +T} T{ +1049 +T} T{ +1.78 +T} +_ +T{ +XL (Fastchip, FAST) +T} T{ +887 +T} T{ +2.1 +T} +_ +T{ +Turbo +T} T{ +825 +T} T{ +2.3 +T} +_ +T{ +XE (FAST) +T} T{ +777 +T} T{ +2.4 +T} +_ +T{ +XE (Fastchip, FAST) +T} T{ +777 +T} T{ +2.4 +T} +_ +T{ +Altirra (Fastchip) +T} T{ +769 +T} T{ +2.43 +T} +_ +T{ +Integer +T} T{ +719 +T} T{ +2.6 +T} +_ +T{ +Integer (FAST) +T} T{ +575 +T} T{ +3.25 +T} +_ +.TE +.sp +Turbo BASIC XL, Atari Microsoft BASIC, and OSS Integer BASIC run at +the same speed with or without the Fastchip ROM, since they don\(aqt use +the OS floating point routines. +.sp +For reference, I rewrote the program in C and compiled it with +cc65. It runs in 349 jiffies, 5.35x as fast as BASIC, with or without +the Fastchip ROM. Since cc65 only supports integer arithmetic, this +probably represents the theoretical maximum speed the algorithm could +run in on the Atari, without rewriting it in assembly. By comparison, +Integer BASIC looks pretty good. +.sp +If you get rid of lines 180 to 210 (don\(aqt print the results), Integer +BASIC with FAST runs it in 245 jiffies, and the equivalent C program +runs in 61 jiffies. This shows that CIO and the E: device are the +"bottleneck" for this program (and that compiled C is still faster +than anything interpreted). .SH BUGS .SS Modulo Arithmetic .sp |