Home
JAQForum Ver 19.8.18
Log In or Join  
Active Topics
Local Time 12:46 22 Aug 2019 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : BASIC Speed Benchmark Tests

     Page 1 of 3    
Author Message
CircuitGizmos

Guru

Joined: 08/09/2011
Location: United States
Posts: 1107
Posted: 06:07pm 11 Feb 2012
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 2012-02-13
Micromites and Maximites! - Beginning Maximite
 
shoebuckle
Senior Member

Joined: 21/01/2012
Location: Australia
Posts: 189
Posted: 10:05pm 11 Feb 2012
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/12/2011
Location: Australia
Posts: 930
Posted: 10:36pm 11 Feb 2012
Copy link to clipboard 

  shoebuckle said   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/08/2011
Location: Australia
Posts: 3055
Posted: 11:43pm 11 Feb 2012
Copy link to clipboard 

  shoebuckle said   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/06/2011
Location: Australia
Posts: 2551
Posted: 12:02am 12 Feb 2012
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/09/2011
Location: United States
Posts: 1107
Posted: 06:50pm 12 Feb 2012
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/01/2012
Location: Australia
Posts: 189
Posted: 07:15am 13 Feb 2012
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/06/2014
Location: Germany
Posts: 667
Posted: 03:48am 26 Aug 2014
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/12/2012
Location: New Zealand
Posts: 6833
Posted: 02:37pm 26 Aug 2014
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/05/2014
Location: Australia
Posts: 116
Posted: 05:25pm 26 Aug 2014
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/12/2012
Location: New Zealand
Posts: 6833
Posted: 12:13am 27 Aug 2014
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/06/2014
Location: Germany
Posts: 667
Posted: 01:27am 27 Aug 2014
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.

MichaelEdited by twofingers 2014-08-28
 
Grogster

Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 6833
Posted: 01:39pm 27 Aug 2014
Copy link to clipboard 

That link lists the Atari 600XL, which is close enough in specs to the 800XL, so I won't bother dragging my old dusty out of it's cupboard.
Smoke makes things work. When the smoke gets out, it stops!
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 1864
Posted: 03:20am 28 Aug 2014
Copy link to clipboard 

These benchmarks can mislead, for example they favour compiled languages and also favour apps with very small amounts of data. Even a slightly larger amount of data (arrays or strings) won't even run (or worse, run but malfunction at run time) on a typical Arduino.

Sack full of salt needed...

John
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 667
Posted: 11:28am 28 Aug 2014
Copy link to clipboard 

@John,

With respect, this is not a competition, it's about what can be done by which means, or not. I'm sure you agree.

I'm sure most users who read here can distinguish between interpreters and compilers and know the limits of Arduinos (If not: UNO: 32K Flash, 2K SRAM // MEGA2580: 256K Flash, 8K SRAM // DUE: 512K Flash, 96K SRAM, 3,3V).

No one wants to compare apples with oranges (pears) or say this system is the best.
For me it was important to see what can be done with one system and what with another. I'm always looking for solutions not ideologies!
How Grogster has already explained: Sometimes speed or price is important, sometimes convenience. I am happy to live in a world where I ... WE! have the choice.

If these benchmarks can mislead someone, then we should perhaps explain better?
Is there someone who needs more informations?

regards
Michael
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 1864
Posted: 11:51am 28 Aug 2014
Copy link to clipboard 

  twofingers said   @John,

With respect, this is not a competition, it's about what can be done by which means, or not. I'm sure you agree.

As you can see, I never mentioned anything about a competition.

They are, however, very selective benchmarks which test almost exclusively CPU speed with little or no data so are in danger of being unlike almost any real life programs for a uC.

I'm merely trying to sound a warning for those who do not realise that. I wouldn't want them to feature on hackaday, for example, which has already featured statements such as being 70 times slower than (whatever) - but slower at what? Well, something meaningless. What matters is whether it's fast enough for what's needed. Gneerally it's way faster than needed because I/O is slow and the things you do with each I/O tend to be quite little in terms of CPU usage.

Back to the sack of salt.

JohnEdited by JohnS 2014-08-29
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 667
Posted: 12:34pm 28 Aug 2014
Copy link to clipboard 

@John,

  Quote  I'm merely trying to sound a warning for those who do not realise that.

I think that is always a good idea! As I said, for me, these benchmarks were useful for a rough estimate. Therefore I posted the results here. I think each benchmark is selective by nature and requires proper interpretation. I think we agree.

Michael Edited by twofingers 2014-08-29
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 1864
Posted: 08:23pm 28 Aug 2014
Copy link to clipboard 

I found the results interesting, too. Mainly they confirmed that a 'mite is "fast enough" for most things, which I think everyone kinda knew anyway but no harm done on that front.

Having seen the bad mouthing on h-a-d, with moderator(s) refusing to post my short factual follow-up, I'm wary of things now, though.

John
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 667
Posted: 03:42am 16 Feb 2015
Copy link to clipboard 

Basic benchmark MicroMite update:
(This is for people who don't have a MicroMite for comparison purposes.)


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
MicroMite 40MHz 0.028 0.18 0.285 0.289 0.644 0.892 1.346 0.376
MicroMite 48MHz 0.023 0.15 0.237 0.24 0.536 0.744 1.121 0.313

C-Language (code see above):
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

"The trick, William Potter, is not minding that it hurts." Lawrence of Arabia?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 2880
Posted: 04:11am 16 Feb 2015
Copy link to clipboard 

Results for the Micromite++ (MX470) at 96MHz
BM1 0.015
BM2 0.103
BM3 0.167
BM4 0.168
BM5 0.326
BM6 0.47
BM7 0.74
BM8 0.216
 
     Page 1 of 3    
© JAQ Software 2019