Email
 Microcontroller and PC projects Forum Index : Microcontroller and PC projects         Section -- Select Forum -- Off grid living and renewables   - Windmills   - Solar   - EV's Electronics and Microcontrollers   - Electronics   - Microcontroller and PC projects   - PCB Manufacturing Miscellaneous   - Other Stuff   - Site News   - Off topic archive. Classifieds   - Price Watch   - Wanted   - For Sale Guest Book   - Guest Book
 Topic: BASIC Speed Benchmark Tests
 Page 1 2 3 4 5 of 5 Next >>
Author
 Message << Prev Topic | Next Topic >>
CircuitGizmos
Guru

Joined: 08 September 2011
Location: United States
Online Status: Offline
Posts: 1094
 Posted: 12 February 2012 at 4:07am | IP Logged Copy link to clipboard
I updated to MMIDE2.0h so that I could run some tests.

Since the Maximite is an "80's Computer" I decided to run some 1980s BASIC benchmark
tests.

I got some of the numbers that you can compare to from Wikipedia:

 BM1    BM2     BM3    BM4    BM5    BM6    BM7    BM8 ABC 800 single precision   0.9    1.8     6.0    5.9    6.3   11.6   19.6    2.9 ABC 800 double precision   1.2    2.2    10.0   10.6   11.0   17.8   26.4   14.4 IBM PC                     1.5    5.2    12.1   12.6   13.6   23.5   37.4    3.5 Apple III                  1.7    7.2    13.5   14.5   16.0   27.0   42.5    7.5 VIC-20                     1.4    8.3    15.5   17.1   18.3   27.2   42.7    9.9 ZX81 in "fast mode"        4.5    6.9    16.4   15.8   18.6   49.7   68.5   22.9 Maximite                   0.016  0.144   0.196  0.205  0.354  0.512  0.721  0.31

Here is the code for the Maximite:

 Print "Maximite Benchmark tests" Print " " Print "Benchmark 1" Timer = 0 For j = 1 To 1000 Next j Print Timer / 1000 Print " " Print "Benchmark 2" Timer = 0 j =j0 BM2: j = j+1 If j < 1000 GoTo BM2 Print Timer / 1000 Print " " Print "Benchmark 3" Timer = 0 j = 0 BM3: j = j+1 a = j/j*j+j-j If j < 1000 GoTo BM3 Print Timer / 1000 Print " " Print "Benchmark 4" Timer = 0 j = 0 BM4: j = j+1 a = j/2*3+4-5 If j < 1000 GoTo BM4 Print Timer / 1000 Print " " Print "Benchmark 5" Timer = 0 j = 0 BM5: j = j+1 m = j/2*3+4-5 Gosub 4000 If j < 1000 GoTo BM5 Print Timer / 1000 Print " " Print "Benchmark 6" Timer = 0 j = 0 dim ray(5) BM6: j = j+1 m = j/2*3+4-5 Gosub 4000 For q = 1 TO 5 Next q If j < 1000 GoTo BM6 Print Timer / 1000 Print " " Print "Benchmark 7" Timer = 0 j = 0 dim ray2(5) BM7: j = j+1 m = j/2*3+4-5 Gosub 4000 For q = 1 TO 5 ray2(q) = m Next q If j < 1000 GoTo BM7 Print Timer / 1000 Print " " Print "Benchmark 8" Timer = 0 j = 0 BM8: j = j+1 m = j^2 blog = LOG(j) csin = SIN(j) If j < 1000 GoTo BM8 Print Timer / 1000 End 4000 RETURN

Edited by CircuitGizmos on 12 February 2012 at 4:09am

__________________
Micromites and Maximites! - Beginning Maximite

shoebuckle
Senior Member

Joined: 21 January 2012
Location: Australia
Online Status: Offline
Posts: 189
 Posted: 12 February 2012 at 8:05am | IP Logged Copy link to clipboard
Running the benchmarks on my Maximite produced a 10% speed increase. I wonder why.
BM1 0.016
BM2 0.116
BM3 0.178
BM4 0.179
BM5 0.339
BM6 0.484
BM7 0.694
BM8 0.231

Cheers,
Hugh

BobD
Guru

Joined: 07 December 2011
Location: Australia
Online Status: Offline
Posts: 930
 Posted: 12 February 2012 at 8:36am | IP Logged Copy link to clipboard
shoebuckle wrote:
 Running the benchmarks on my Maximite produced a 10% speed increase. I wonder why.

the electrons are probably frozen in the US and running slower.

TassyJim
Guru

Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2988
 Posted: 12 February 2012 at 9:43am | IP Logged Copy link to clipboard
shoebuckle wrote:
 Running the benchmarks on my Maximite produced a 10% speed increase. I wonder why. Hugh

There is a difference between VGA and Composite video.
Also setting Video OFF makes a difference.

Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm

Geoffg
Guru

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2495
 Posted: 12 February 2012 at 10:02am | IP Logged Copy link to clipboard
That is an amazing speed difference.

MMBasic is written in C (not hand crafted assembler like MicroSoft BASIC) and as a hobby project. My aim was to run at least as fast as the old computers but I did not expect it to be that much faster.

All the credit should go to the PIC32. It is an amazing chip. Writing code for it is very much like writing for the huge minicomputers of 10 or 15 years ago and sometimes I have to stop and look at the little chip to remind myself that everything is happening in there... and at an exceptional speed.

Thanks Rob, a great post.

Geoff

__________________
Geoff Graham - http://geoffg.net

CircuitGizmos
Guru

Joined: 08 September 2011
Location: United States
Online Status: Offline
Posts: 1094
 Posted: 13 February 2012 at 4:50am | IP Logged Copy link to clipboard
Typo:

Print "Benchmark 2"
Timer = 0
j =j0

Should be "j = 0"

Thanks, Hugh!

__________________
Micromites and Maximites! - Beginning Maximite

shoebuckle
Senior Member

Joined: 21 January 2012
Location: Australia
Online Status: Offline
Posts: 189
 Posted: 13 February 2012 at 5:15pm | IP Logged Copy link to clipboard
I had a look at the original benchmark programs and there seemed to be a couple of differences between them and CircuitGizmos'.
a) It looked like the original benchmarks (with line Nos) were run separately which would make them run more quickly than in a single program as CircuitGizmos'.
b) The original benchmarks omitted all unnecessary spaces from IF statements and assignments (e.g. j=j+1 rather than j = j + 1 and If j<1000 rather than If j < 1000).

I ran the benchmarks separately, with and without line numbers, and with all unnecessary spaces removed. There isn't much difference without line Nos as each program is very short. However, what does make a difference is omitting unnecessary spaces within commands. I also found that indenting for readability made very little difference to the times. The last 2 lines here are my results.

 BM1    BM2     BM3    BM4    BM5    BM6    BM7    BM8 ABC 800 single precision   0.9    1.8     6.0    5.9    6.3   11.6   19.6    2.9 ABC 800 double precision   1.2    2.2    10.0   10.6   11.0   17.8   26.4   14.4 IBM PC                     1.5    5.2    12.1   12.6   13.6   23.5   37.4    3.5 Apple III                  1.7    7.2    13.5   14.5   16.0   27.0   42.5    7.5 VIC-20                     1.4    8.3    15.5   17.1   18.3   27.2   42.7    9.9 ZX81 in "fast mode"        4.5    6.9    16.4   15.8   18.6   49.7   68.5   22.9 Maximite                   0.016  0.144  0.196  0.205  0.354  0.512  0.721  0.310 Maximite with line Nos     0.016  0.131  0.193  0.194  0.245  0.393  0.582  0.241 Maximite without line Nos  0.016  0.111  0.173  0.173  0.192  0.336  0.525  0.220

Cheers,
Hugh

twofingers
Guru

Joined: 02 June 2014
Location: Germany
Online Status: Offline
Posts: 645
 Posted: 26 August 2014 at 1:48pm | IP Logged Copy link to clipboard
Last year I bought my first TFT Maximite. This BASIC benchmark was one of the first threads I have read here. To estimate the speed I wanted a comparison with Arduino. Of course, the native language of the Arduino is not Basic. Therefore, I tried to convert the benchmark in C (kind of ). Here are the results (if anyone is interested).

 // Arduino Benchmark // Compare to http://cpcwiki.eu/index.php/BASIC_Benchmark // is working with UNO, MEGA and DUE // No warranty, provided at your own risk. // This sample may be freely distributed without charge  // twofingers at TBS 08-2014 const int BAUD_RATE = 9600, LOOPS=1000; float j, a, m, blog, csin; float ms,sum_ms; int q; float ray[5]; void G4000(void) {} void setup() {   Serial.begin(BAUD_RATE); } void loop() {   Serial.println("Arduino Benchmark tests");   Serial.println(" ");   Serial.println("Benchmark 1");   ms = millis();   sum_ms=0;   for (j = 1; j <= LOOPS; j++)   {   }   Serial.println((millis() - ms) / 1000, 4);   sum_ms =+ millis() - ms,   delay(1000);   Serial.println("Benchmark 2");   ms = millis();   j = 0; BM2:   j++;   if (j < LOOPS)   {     goto BM2;   }   Serial.println((millis() - ms) / 1000, 4);   sum_ms =+ millis() - ms;   delay(1000);   Serial.println("Benchmark 3");   ms = millis();   j = 0; BM3:;   j++;   a = j / j * j + j - j;   if (j < LOOPS)   {     goto BM3;   }   Serial.println((millis() - ms) / 1000, 4);   sum_ms =+ millis() - ms;   delay(1000);   Serial.println("Benchmark 4");   ms = millis();   j = 0; BM4:;   j++;   a = j / 2 * 3 + 4 - 5;   if (j < LOOPS)   {     goto BM4;   }   Serial.println((millis() - ms) / 1000, 4);   sum_ms =+ millis() - ms;   delay(1000);   Serial.println("Benchmark 5");   ms = millis();   j = 0; BM5:;   j++;   m = j / 2 * 3 + 4 - 5;   G4000();   if (j < LOOPS)   {     goto BM5;   }   Serial.println((millis() - ms) / 1000, 4);   sum_ms =+ millis() - ms;   delay(1000);   Serial.println("Benchmark 6");   ms = millis();   j = 0; BM6:;   j++;   m = j / 2 * 3 + 4 - 5;   G4000();   for (q = 1; q <= 5; q++)   {   }   if (j < LOOPS)   {     goto BM6;   }   Serial.println((millis() - ms) / 1000, 4);   sum_ms =+ millis() - ms;   delay(1000);   Serial.println("Benchmark 7");   ms = millis();   j = 0; BM7:;   j++;   m = j / 2 * 3 + 4 - 5;   G4000();   for (q = 1; q <= 5; q++)   {     ray[q] = m;   }   if (j < LOOPS)   {     goto BM7;   }   Serial.println((millis() - ms) / 1000, 4);   sum_ms =+ millis() - ms;   delay(1000);   Serial.println("Benchmark 8");   ms = millis();   j = 0; BM8:;   j++;   m = pow(j, 2);   blog = log(j);   csin = sin(j);   if (j < LOOPS)   {     goto BM8;   }   Serial.println((millis() - ms) / 1000, 4);   sum_ms =+ millis() - ms;   Serial.print("Avg: ");   Serial.println(sum_ms/8/1000,4);   Serial.println();   Serial.println("Arduino Benchmark");   Serial.println("F i n i s h e d !");   Serial.println();   while(1); }

 BM1    BM2     BM3    BM4    BM5    BM6    BM7    BM8 ABC 800 single precision   0.9    1.8     6.0    5.9    6.3   11.6   19.6    2.9 ABC 800 double precision   1.2    2.2    10.0   10.6   11.0   17.8   26.4   14.4 IBM PC                     1.5    5.2    12.1   12.6   13.6   23.5   37.4    3.5 Apple III                  1.7    7.2    13.5   14.5   16.0   27.0   42.5    7.5 VIC-20                     1.4    8.3    15.5   17.1   18.3   27.2   42.7    9.9 ZX81 in "fast mode"        4.5    6.9    16.4   15.8   18.6   49.7   68.5   22.9 Maximite                   0.016  0.144  0.196  0.205  0.354  0.512  0.721  0.310 Maximite with line Nos     0.016  0.131  0.193  0.194  0.245  0.393  0.582  0.241 Maximite without line Nos  0.016  0.111  0.173  0.173  0.192  0.336  0.525  0.220 Arduino UNO                0.010  0.010  0.058  0.043  0.043  0.043  0.045  0.284 Arduino DUE                0.003  0.003  0.006  0.007  0.007  0.007  0.106  0.014

With this I do not intend to criticize Geoff's great work! I like his comprehensive Basic because its not only a programing language, it's also a operating system! Some of us often forget. ... And I've still no viruses, trojans or BOT activities found.

Michael

Grogster
Guru

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6580
 Posted: 27 August 2014 at 12:37am | IP Logged Copy link to clipboard
That's a useful comparison, actually - thanks for posting.

As you say - Ardiuno is a different beast, really, so comparing compiled C code running on the Arduino, to an interpreted language running on the MaxiMite series, is, as others have pointed out, apples and oranges to some extent.

Still, the figures are useful. What I glean from this is that if you NEED raw speed, then you are better perhaps to concentrate your efforts with an Arduino. If, on the other hand, speed is not THAT critical, and you need ease of use, then the MM is an ideal choice.

For me, the MM was the winner for a couple of reasons: On-board SD card and filesystem built right into the MMBASIC, VGA output, sound output - all on-board. Now, you can easily add all of these to the Arduino with modules, but I liked the idea that everything was in one chip with the MMBASIC.

As Dave on the EEVBLOG has said: "Just use the one that works for you."

__________________
Smoke makes things work. When the smoke gets out, it stops!

halldave
Senior Member

Joined: 04 May 2014
Location: Australia
Online Status: Offline
Posts: 116
 Posted: 27 August 2014 at 3:25am | IP Logged Copy link to clipboard
Has anyone got a working Dick Smith System 80 or Tandy TRS-80 Model I Level II they could run these Benchmarks on?

Grogster
Guru

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6580
 Posted: 27 August 2014 at 10:13am | IP Logged Copy link to clipboard
Not one of those, but I do have a working Atari 800XL - perhaps I should do the benchmarks on it.

At the fantastic speed of 1.8MHz for the 800XL, I would expect that the MaxiMite will run rings around the Atari.

__________________
Smoke makes things work. When the smoke gets out, it stops!

twofingers
Guru

Joined: 02 June 2014
Location: Germany
Online Status: Offline
Posts: 645
 Posted: 27 August 2014 at 11:27am | IP Logged Copy link to clipboard
@Grog

Quote:
 As you say - Ardiuno is a different beast, really, so comparing compiled C code running on the Arduino, to an interpreted language running on the MaxiMite series, is, as others have pointed out, apples and oranges to some extent. […] As Dave on the EEVBLOG has said: "Just use the one that works for you."

Precisely! I could not express better!

Sometimes I miss "int" and "char" on my Maximites, this could also improve the speed. But I think Geoff has a limited time contingent and he tries to keep the language as simple as possible. And he has already done so much. I'm very grateful for his work!

@halldave

at http://cpcwiki.eu/index.php/BASIC_Benchmark

You will find some Basic benchmarks more. But no TRS-80. It seems that the results are all in a range, depending on the CPU and the clock rate used.

Michael

Edited by twofingers on 27 August 2014 at 11:59am