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

Tiny Basic 1.2 Progress

I'm working on the next release of Tiny Basic. Here's the latest list of enhancements: Added GOSUB/RETURN statements. Added TITLEBAR statement for the interpreter console. Increased program lines from 100 to 1024. Rewrote the MEM code. Added runtime error handling in the interpreter. It trys to recover to the READY prompt. Created test program for the interpreter (i.e. primitive unit testing). Granted that some of these changes are behind the scenes, but I'm trying to increase the robustness of the interpreter without refactoring it into something completely different. Before I release Tiny Basic 1.2, I still want to add these features: String variables (i.e. a$ -- z$). FOR/NEXT loops Fix known bugs in current version. The work continues...

Run Basic RC1 Released

Carl invited me to be a beta tester for his upcoming Run Basic product about 4 months ago. This week he released Release Candidate 1 to the beta testing group. It's been exciting to see the evolution of RB from Beta 2 through Beta 5 to RC1. New features that aren't publicly available at www.runbasic.com include: A new syntax to use objects. (e.g. #object method). You can see the Smalltalk influence and the syntax leverages a Liberty Basic programmer's conceptual model of handles. An XMLparser object. A SQLITE object. A FILE object. A TABLE object. HTTPGet$ function that performs an HTTP GET. Carl stated that there will be a few more release candidates before the official release of the Run Basic Personal Server. There will be an "Enterprise" version available at a later date which should include version control and enterprise database access. This release will be the most significant event in the Basic programming world since the introduction of Visual Basic for...

Liberty Basic in 2010

This past year has seen some modest progress in the world of Liberty Basic: Carl published a book titled Beginning Programming with Liberty BASIC . This is a great book -- I read it from cover to cover. Even if you're an experienced programmer, it is a fast way to get the gist of the language and you may even pick up a few new things along the way. Liberty Basic 4.04. This release offers better compatibility with Windows Vista and 7. It also fixes some bugs. I think it will be the last release of the 4.x version. Liberty Basic Pro. This is just 4.04 and Assist combined into a single product. Hopefully 2011 will be the year of Run Basic.