Jeśli chcesz wziąć udział w dyskusjach na forum - zaloguj się. Jeżeli nie masz loginu - poproś o członkostwo.
Vanilla 1.1.4 jest produktem Lussumo. Więcej informacji: Dokumentacja, Forum.
Millfork YoshPlus:41921 iterations in 100 ticks
CC65 YoshPlus:41844 iterations in 100 ticks
Mad Pascal YoshPlus:35572 iterations in 100 ticks
Action! YoshPlus:33239 iterations in 100 ticks
Quick 2.2 YoshPlus:21320 iterations in 100 ticks
Quick 1.6 YoshPlus:16242 iterations in 100 ticks
PL65 YoshPlus: 4708 iterations in 100 ticks
FastBasic FBI YoshPlus: 2427 iterations in 100 ticks
fig-Forth 1.1 YoshPlus: 715 iterations in 100 ticks
CLSN Pascal YoshPlus: 487 iterations in 100 ticks
Millfork Chessboard: 79 iterations in 150 ticks
CC65 Chessboard: 76 iterations in 150 ticks
Mad Pascal Chessboard: 40 iterations in 150 ticks
Action! Chessboard: 35 iterations in 150 ticks
Quick 2.2 Chessboard: 27 iterations in 150 ticks
Quick 1.6 Chessboard: 16 iterations in 150 ticks
PL65 Chessboard: 12 iterations in 150 ticks
BYTE RTCLOK2=19,RTCLOK3=20
BYTE ARRAY FLAGS(8192)
CARD COUNT,I,END,KROK
PROC SIEVE()
RTCLOK2=0
RTCLOK3=0
COUNT=1
FOR I=1 TO 8191 STEP 2
DO
FLAGS(I)=1
OD
FOR I=3 TO 91 STEP 2
DO
IF FLAGS(I) THEN
; PRINTF("%U ",I)
END=I*I
KROK=I+I
WHILE (END < 8192)
DO
; PRINTF("%U ",END)
FLAGS(END)=0
END==+KROK
OD
FI
OD
END=RTCLOK2*256+RTCLOK3
FOR I=3 TO 8191 STEP 2
DO
IF FLAGS(I)THEN
COUNT==+1
; PRINTF("%U ",I)
FI
OD
PRINTF("%E %U LICZB PIERWSZYCH W CZASIE",COUNT)
PRINTF("%E %U RAMEK",END)
RETURN
? "STARTING FASTBASIC..."
STIME = TIME
DIM FLAGS(8190) BYTE
MSET ADR(FLAGS), 8190,0
FOR N=2 TO 91
IF NOT FLAGS(N)
FOR K=N*N TO 8190 STEP N
FLAGS(K)=1
NEXT K
ENDIF
NEXT N
ETIME = TIME
? "JIFFIES: ";ETIME-STIME
COUNT=0
FOR N=2 TO 8191
IF NOT FLAGS(N)
COUNT=COUNT+1
ENDIF
NEXT N
? "PRIMES: ";COUNT
./fastbasic-int RESIEVE.FBI fbisieve.asm
cl65 -t atari -C fastbasic.cfg fbisieve.asm -o fbisieve.xex fastbasic-fp.lib
thorfdbg:
Basic++, with Os++ gives me 3874 jiffies, 1028 primes. You are likely using the original Os, with the original (slow) mathpack.Millfork YoshPlus:41921 iterations in 100 ticks
CC65 YoshPlus:41844 iterations in 100 ticks
Mad Pascal YoshPlus:35572 iterations in 100 ticks
Action! YoshPlus:33239 iterations in 100 ticks
Quick 2.2 YoshPlus:21320 iterations in 100 ticks
Quick 1.6 YoshPlus:16242 iterations in 100 ticks
PL65 YoshPlus: 4708 iterations in 100 ticks
FastBasic FBI YoshPlus: 2427 iterations in 100 ticks
fig-Forth 1.1 YoshPlus: 715 iterations in 100 ticks
CLSN Pascal YoshPlus: 487 iterations in 100 ticks
Millfork Chessboard: 79 iterations in 150 ticks
CC65 Chessboard: 76 iterations in 150 ticks
Mad Pascal Chessboard: 40 iterations in 150 ticks
Action! Chessboard: 35 iterations in 150 ticks
Quick 2.2 Chessboard: 27 iterations in 150 ticks
Quick 1.6 Chessboard: 16 iterations in 150 ticks
PL65 Chessboard: 12 iterations in 150 ticks
10 A=4096*5:C=8190:B=A+C:COUNT=0
20 POKE 20,0:POKE 19,0
30 FOR I=A TO B:POKE I,0:NEXT I
40 FOR N=2 TO 91
45 Z=N+A
50 IF PEEK(Z)=1 THEN 90
60 FOR K=N*N TO 8190 STEP N
70 POKE K+A,1
80 NEXT K
90 NEXT N
95 TIME=PEEK(20)+256*PEEK(19)
100 PRINT TIME;" JIFFIES"
200 FOR N=2 TO 8191
210 IF PEEK(N+A)=0 THEN COUNT=COUNT+1
215 NEXT N
220 PRINT COUNT;" PRIMES"
Zbyti:
Jak zacząłem tę zabawę to myślałem o jakimś art. na AOL skompilowanym z wypowiedzi szanownych ekspertów udzielających się na tym forum, jednak wraz z rozwojem wątku udzielający się panowie zaspokoili moją ciekawość albo zalinkowali strony gdzie doczytałem co mnie interesowało.100 DIM B$(1000)
110 FOR A=1 TO 1000
120 B$(A,A)="*"
130 NEXT A
140 PRINT B$
100 DIM B$(1000)
110 B$="*":B$(1000)="*":B$(2)=B$
120 PRINT B$
xxl:
no ale skoro optymalizowac to zamiast:10 POKE 20,0:POKE 19,0:COUNT=0
20 DIM F$(8191):F$="F":F$(8191)="F":F$(2)=F$
30 FOR N=2 TO 91
40 IF F$(N,N)="T" THEN 80
50 FOR K=N*N TO 8190 STEP N
60 F$(K,K)="T"
70 NEXT K
80 NEXT N
90 TIME=PEEK(20)+256*PEEK(19)
100 PRINT TIME;" JIFFIES"
200 FOR N=2 TO 8191
210 IF F$(N,N)="F" THEN COUNT=COUNT+1
220 NEXT N
230 PRINT COUNT;" PRIMES"
10 POKE 20,0:POKE 19,0:COUNT=0
20 DIM F$(8192):F$="F":F$(8192)=F$:F$(2)=F$:X=ADR(F$)
30 FOR N=2 TO 91
40 IF PEEK(N+X)=1 THEN 80
50 FOR K=N*N TO 8190 STEP N:POKE K+X,1
70 NEXT K
80 NEXT N
90 TIME=PEEK(20)+256*PEEK(19)
100 ? TIME;" TICKS"
200 FOR N=2 TO 8191
210 IF PEEK(N+X)=70 THEN COUNT=COUNT+1
220 NEXT N
230 ? COUNT;" PRIMES"