Skip to main content

Tiny Basic Sieve Benchmark

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 " primes found."

430 PRINT "End of iteration. Elapsed time in milliseconds: ";

440 PRINT z - a

450 END

Comments

Popular posts from this blog

Run BASIC Hosting Service Launched

The new Run BASIC hosting service launched at midnight! Please visit http://runbasichosting.com for more details. Monthly and annual subscriptions are available. Run BASIC , a product by ShopTalk Systems, is a tool that makes it easy to create your own web applications. No computer science degree required . Run BASIC Hosting is a service that makes it easy to deploy your applications to the Internet. No IT experience required .

BASIC turns 50

Well, the BASIC language actually turned 50 on May 1, 2014, and I'm very late to the party. Born at Dartmouth in 1964 (along with the first commercial time sharing), here is the university's tribute page . There is even a great 38 minute documentary that they made for the occasion. 10 PRINT "ENJOY" 20 GOTO 10

How to set the System Restore and Shadow Copy storage limit in Windows Vista

I ran into a problem recently where Windows Vista kept using up all of my available disk space for System Restore and Shadow Copy storage. There is a feature in the Disk Cleanup utility that lets you manually delete all but the most recent snapshot. I did that for months before I finally took the time to figure out how to set the limit. My problem was pretty extreme. My HP Pavilion laptop has a 105 gig disk drive. I have about 47 gigs free and over a period of about a month, Vista would use it all up. Vista is supposed to use only 15% of the hard disk for this storage, but apparently sometimes that limit can become UNBOUNDED. I don't know how that happens. To see the current setpoint for your system, go to a command prompt and type the following: vssadmin list shadowstorage You should see something like the following: To change the current setpoint for your system, type the following but change what's necessary to match your system. For example, you may need to change the drive