If someone asked you how "fast" an ardui

If someone asked you how "fast" an arduino is.........what would you compare it to? Say you were talking someone not familiar with microprocessors in general.

Could it be roughly compared to some computer of the past? Say an early 8088? An old Atari/Commodore/Timex Sinclare/ect...?

About 12 times faster than the original IBM-PC ?

The 8088 cpu used in the original PC had a CPU that took 3 cycles of the 4.77MHz clock to do something like a register to register ADD instruction that the Arduino does in 1 cycle of its 16MHz clock. Of course, the 8088 had a lot more memory, and a more complex instuctions set, and 16bit adds were the same speed, but the 12 times number should be about right.

The "4MHz Z80" used in CPM machines prior to the IBM PC took 4 clock cycle for similar operations, so it was about 16x slower than an Arduino.

Zippier than you'd think, eh?

My first Apple II had 4k of memory (storing programs and data) and ran at 1MHz. Arduino runs 16 times faster and the latest versions have 32k of program memory and 2k of RAM. But comparing computers with different architectures is like comparing apples to ? (well, you see what I mean).

But if you want to express some idea of how fast Arduino can be, it can switch a pin on or off (using direct port io) in less then the time it takes a light beam to travel 20 meters.

Hi,

To satisfy my curiosity I compiled and ran the following sketch on a Diecimila:

/*

  • SpeedTest
  • JRG 2009.03.21

*/

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

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

Using my scope to observe the output of pin 13 I find:

on time = 3.312 us
off time = 3.917 us
frequency = 136.642 KHz

So using the Arduino IDE instructions is significantly slower than using direct port I/O .

John

I think you have some of the loop time in there. I measured the duration of digitalWrite HIGH followed by digitalWrite LOW at 4.5 microseconds.

This picture shows the timing difference compared to direct port IO (about 35 times faster)

The markers at the top are 1us intervals

My first Apple II had 4k of memory (storing programs and data)

That raises a very interesting point too. The ATmega's Harvard architecture (separate data and program memories) mean that it can be fetching the next instruction concurrantly while executing the instruction it's on even if the current instruction has to do IO. That can also give it a nice speed boost over the 6502 in the Apple II and the 8088 family chips.

and ran at 1MHz. Arduino runs 16 times faster and the latest versions have 32k of program memory and 2k of RAM.

I took a fourth year computer architecture course that can be summed up as "clock speed has nothing to do with computing power".

So using the Arduino IDE instructions is significantly slower than using direct port I/O .

Additional discussion here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230286016
(anyone have a z80 simulator or similar to try out the equivalents? Near equivalents, I guess.)

I took a fourth year computer architecture course that can be summed up as "clock speed has nothing to do with computing power".

Yeah, no kidding. The old quote (Mark Twain?) "there are three kinds of lies: lies, damned lies, and statistics" is really true when it comes to computer performance metrics. Here's a new favorite of mine from Dilbert: "A misleading benchmark can accomplish in minutes what years of good engineering could never do."

It's funny that I'm looking at a problem that, when executed on an FPGA poking along at 200MHz, I expect it to outrun a ~4GHz microprocessor easily.

The real, ultimate metric is this: does it run my program in a time period that meets my requirements?

-j

If you want accuracy, wouldn't you want to mention MIPS?

Not necessarily, because MIPS doesn't convey how much work is being accomplished by each instruction.

-j

So (work/instruction)*MIPS? Except... how is "work" quantitized? It doesn't seem as straightforward as measuring joules. Well, it might be... a fast chip might be considered a hot one. :stuck_out_tongue:

You begin to see the dilemma in performance metrics. :slight_smile:

I adopted the Arduino as my pet microcontroller not because of the AVR's performance (even though it outruns the old PIC 16f84 by a factor of 3 or 4 - see "cycles per instruction", CPI, metric), but because of the development environment that comes with it.

-j

IMO, the Arduino seems to hit the sweet spot for hobbyists. It's inexpensive, has reasonable performance, and has a very usable tool set. I tried PIC, but decent tools are expensive. And for the price range I was looking for, the Arduino offers much more performance. And you can't beat the price of the toolchain. I found myself doing much more work to get much less return with PIC.

So (work/instruction)*MIPS? Except... how is "work" quantitized? It doesn't seem as straightforward as measuring joules. Well, it might be... a fast chip might be considered a hot one.

This is where that whole course went. The Arduino and PIC chips have are RISC computers so each instruction does very little. A PIC16 series chip doesn't even have a multiply instruction, just 8-bit addition and subtraction. So on a PIC or Arudino it might take you tens-of-thousands of instructions to 64-bit floating point division which a modern desktop CPU can do in a single instruction. By that logic, a desktop running at 1MIPS might be considering 50,000 times faster than an Arduino running at 1MIPS. But not every instruction is a floating point division so that comparision wouldn't be accurate.

I got asked this exact question by my dad, my reply was:

You remember that spectrum zx we used to have? somewhere round
that kinda speed.

do you think that was a bout right?

My other thought was to explain it as somewhere around the speed of a nokia 3100/3300.

Funny timing... There is a cool little article on the SparkFun website about the Apollo computers vs. Atmel uCs 1 MIPS vs 20.

Bumping this thread...

So then, how mush faster is an Arduino Mega? (Just trying to wrap my head around the relative speeds of things.)

The MEGA is exactly the same speed at the regular Arduino (one if its weak points, I guess.) However, it has MUCH more memory; about 8x the program memory and 4x the RAM of the mega168 used in most Arduinos (4x and 2x compared to the mega328.) Plus more pins, times, and uarts, all of which can save a lot of CPU cycles compared to having to implement them in software or via IO expanders of some kind.