Compared to the Sieve benchmarks in previous posts, Tiny Basic is very slow. In fact, it's much slower than I anticipated. I ran Tiny Basic on both the Run Basic public server and Liberty Basic 4.03 on my laptop. Here are the numbers: After 5000, the Run Basic program exceeded the allowable time on the public server. The following is the Sieve program. I had to use IF statements because Tiny Basic doesn't have a FOR/NEXT loop yet. 10 REM sieve2 20 REM ported to Tiny Basic from Liberty Basic by David den Haring 30 REM last updated: 8-14-07 40 REM s -- size, a() -- flags array, a -- start time, z -- end time 50 REM i -- loop counter, p -- prime, c -- prime count, k -- temp 60 s = 7000 : i = 1 70 a = ms 80 IF a(i) > 0 THEN GOTO 300 90 p = (i + i + 3) 100 k = i + p 110 IF k > s THEN GOTO 290 120 a(k) = 1 130 k = k + p 140 GOTO 110 290 c = c + 1 300 i = i + 1 310 IF i > s THEN GOTO 400 320 GOTO 80 400 z = ms 410 PRINT c; 420 PRINT...
My lifelong quest for playful programming and simple, reliable computing in all of its forms