BASIC Speed Benchmark Tests


Author Message
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 679
Posted: 03:48am 26 Aug 2014      

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