chipKIT® Development Platform

Inspired by Arduino™

Performance of chipKIT Uno32 vs Arduino Uno

Created Tue, 24 May 2011 18:59:13 +0000 by laelfrog


laelfrog

Tue, 24 May 2011 18:59:13 +0000

I've got a project that I've been working on that ran into performance issues with the Arduino Uno using a bunch of float math computations (Lots of HSV Color manipulations)

The Arduino is an 8 bit processor @ 16mhz, so I'd imagine that I'd get a beefy speed boost with the chipKIT Uno32 seeing that its 32bit and 80mhz.
What kind of performance boost should I expect? Its 5x the clock speed, and an 8 bit vs 32bit float operations. (2x? 4x? 8x?)

Can I reasonably expect a 10-20x speed increase in my float math intensive routines?

Anyone else have some performance comparisons that could help me get a grasp on what the performance of the chipKIT Uno32 (or max) would be?


jasonk

Tue, 24 May 2011 20:31:00 +0000

Maybe if you post some example code, someone with an UNO32 can time it for you?


ricklon

Tue, 24 May 2011 22:36:38 +0000

Some accuracy sketches would be cool too.

You might consider using the ArduinoTestSuite and library format and make them repeatable tests. [url]http://code.google.com/p/arduino/wiki/ArduinoTestSuite[/url]

--Rick


nkcelectronics

Wed, 25 May 2011 01:55:01 +0000

I ran some benchmarks:

Test 1: long integer

// Arduino Uno vs chipKIT speed test
// Core CPU
// NKC Electronics

unsigned long time;

void setup(){
  Serial.begin(9600);
}
void loop(){
  unsigned long i, j, k;
  
  Serial.print("Time: ");
  time = micros();
  j=0;
  //prints time since program started
  for (i=0; i<10000L; i++)
    for (j=0; j<10000L; j++)
      k += j;
  Serial.print(micros()-time);
  Serial.print(' ');
  Serial.println(k);
  // wait a second so as not to send massive amounts of data
  delay(1000);
}

Uno = 8800 us (micro seconds) Uno32 = 250 us

Uno32 is aprox 35 times faster

Test 2: Floating point (double)

// Arduino Uno vs chipKIT speed test
// Core CPU FPU
// NKC Electronics

unsigned long time;

void setup(){
  Serial.begin(9600);
}
void loop(){
  unsigned long i, j;
  double f;
  
  Serial.print("Time: ");
  time = micros();
  j=0;
  //prints time since program started
  for (i=0; i<100L; i++)
    for (j=0; j<100L; j++)
      f = f * j;
  Serial.print(micros()-time);
  Serial.print(' ');
  Serial.println(f);
  // wait a second so as not to send massive amounts of data
  delay(1000);
}

Uno = 80000 us (micro seconds) Uno32 = 11752 us

Uno32 is aprox 7 times faster

Test 3: digitalWrite() without delay (square wave generator?)

// Arduino Uno vs chipKIT speed test
// digitalWrite without delay
// NKC Electronics

void setup(){
  pinMode(8, OUTPUT);
}

void loop(){
  digitalWrite(8, HIGH);
  digitalWrite(8, LOW);
}

Uno: generates 120 KHz square wave Uno32: generates 628 KHz square wave

Uno32 is aprox 6 times faster


jasonk

Wed, 25 May 2011 04:30:01 +0000

Hi nkcelectronics,

Thanks for the information. Even though the UNO32 looks pretty good with these results, I do have some concerns about the code in Test 1 and Test 2. With local variables and constants, the compiler optimizations come into play so you might not be getting the real numbers.

For instance, in this code:

void loop(){
  unsigned long i, j, k;
  
  Serial.print("Time: ");
  time = micros();
  j=0;
  //prints time since program started
  for (i=0; i<10000L; i++)
    for (j=0; j<10000L; j++)
      k += j;

With optimizations enabled, the compiler can compute the result of k at compile time and skip the loops. Maybe something like this would give you a more useful result? Even though the code is generally considered bad programming practice, it should give you more useful timing information.

volatile unsigned long k;
 void loop(){ 
  unsigned long i, j;
  Serial.print("Time: ");
  time = micros();
  j=0;
  //prints time since program started
  for (i=0; i<10000L; i++)
    for (j=0; j<10000L; j++)
      k += j;

Thanks again for checking the speeds.


nkcelectronics

Wed, 25 May 2011 09:50:40 +0000

Jason, you are right. My code was just a quick test and it is just the beginning. Of the 3 examples, I think digitalWrite() one is the most useful, as it shows the chipKIT capability of bitbanging using pure Arduino code and not going down to the hardware level, as was needed in the Arduino platform with direct PORT access, attempting against code / library portability.


nkcelectronics

Wed, 25 May 2011 11:14:07 +0000

Jason, with your suggested modification to integer speed test:

Uno: 207499240 us (microsecs) Uno32: 8764296 us

Uno32 is aprox 23 times faster


jasonk

Wed, 25 May 2011 15:44:33 +0000

Great, thanks for the update.

P.S. I saw that you already have your Protoshield KIT for sale (http://www.nkcelectronics.com/Protoshield-KIT-for-chipKIT-Uno32_p_226.html). Talk about fast!


nkcelectronics

Wed, 25 May 2011 16:02:33 +0000

Yes, everything is faster with the chipKIT :D


WestfW

Fri, 27 May 2011 07:27:33 +0000

Does PIC32 do 64-bit floats? Initial tests say "double" is still only 32 bits - is that an Arduino compatibility hack or is that normal for PIC32?


laelfrog

Fri, 27 May 2011 16:20:47 +0000

Excellent! Awesome responses!

Just saw a benchmark on Hack A Day. http://hackaday.com/2011/05/27/chipkit-uno32-first-impressions-and-benchmarks/


jasonk

Fri, 27 May 2011 16:55:03 +0000

A 'long double' is 64 bits. Keep in mind that we are still playing around with some things so they may change in the future.


laelfrog

Sun, 04 Sep 2011 16:56:38 +0000

For my calculations (float math intensive) the Chipkit is ~ 11.8x faster than my Arduino Uno.

Chipkit Uno32: took: 15983 milliseconds to do 1million color conversions, so thats 62566.5 conversions per second

Arduino Uno: took: 18908 milliseconds to do 100k color conversions which is 5289 conversions per second. (huge difference!)