Close

How fast is this thing, anyway ?

A project log for Kobold K2 - RISC TTL Computer

A 16 bit RISC computer with video display, from just a few TTL and memory chips. Online C compiler and simulator available.

roelhroelh 07/18/2020 at 15:471 Comment

It is interesting to know how the performance of the Kobold K2 compares to well-known processors. I did compare it to:

Summary

If you don't have the time to read the whole log, here are the results for a Kobold at 6.25 MHz:


Kobold processor running the Sieve program

There is only one classic test that is familiar, very often used, and easy to perform:

It's called the Sieve of Eratosthenes.

Here is the C source code for Kobold K2:

The Kobold C compiler generates the following assembly code:

For the speed, the inner loop is the most important. You can see here that the loop has 7 instructions, that is 14 cycles (every instruction takes 2 cycles). 

The prototype runs from a 25 MHz oscillator, and the cycle speed is 1/4 of that: It does 6.250.000 cycles per second. 

The whole sieve program (10 iterations) took 3.3 seconds (timed with an app on my phone).

Compare with AVR

I found in this article that the 16 MHz 8-bit AVR takes 14 sec to do the benchmark:

So for the sieve, 6.25 MHz Kobold K2 is around 4 times faster than a 16 MHz AVR !

Compare with 6502

In this post someone describes the performance of his hand-optimized assembler sieve code for the 6502, taking 49 cycles for the inner loop:

In our case, Kobold K2 does in 14 cycles what the 6502 does in 49 cycles. That makes Kobold 3.5 times faster.

But Kobold's cycles are faster: 160 nS. For a 2 MHz 6502, cycles are 500nS. So this gives another gain of 3.125 in speed.

So for the sieve, 6.25 MHz Kobold K2 is 10.9 times faster than a 2 MHz 6502 !

And it does not even need hand-optimized assembler code to do this. The C compiler does its job well !


Compare with 68000

In a follow-up article, Byte jan 1983, many users shared their result for the sieve running on an 8 MHz 68000, compiled by several compilers:

The highest speed was 0.49 sec for an assembly program, and the lowest 27 sec for a Forth system.

To our surprise we see that in this test, the 6.25 MHz Kobold K2, with its 3.3 seconds time, beats all C, Ada and Pascal compilers targeting an 8 MHz 68000 !

Compare with 8086

We use this Byte article from aug 1983 for comparing with the 8086. The benchmarks were performed on a 10 MHz 8086.

In the sieve test, the 6.25 MHz Kobold K2, with its 3.3 seconds time, beats all C compilers targeting a 10 MHz 8086 ! The Lattice compiler comes closest with 3.6 seconds.

Compare speed of function calls

The sieve program test mostly loop and array performance. In the mentioned 1983 Byte article , there is another interesting test. It is calculating Fibonacci numbers with a recursive algorithm. It is very inefficient, but it does a lot of function calls, so it is very suitable to measure the efficiency of function calls and returns.

The following is the assembly listing after C compiler and assembler did their work:

This function is called with the value 24 as argument, that's the highest number that gives a result still fitting in 16 bits. Just as with the sieve, the fib(24) call is repeated 10 times, and the total amount of time is recorded.

On the Kobold K2, this took around 5 seconds. 

Let's see what was reported for the 8086 back in 1983:

The result is even better than with the sieve program:

In the fibonacci test, the 6.25 MHz Kobold K2, with its 5 seconds time, beats all C compilers targeting a 10 MHz 8086 with a factor 3 or more !

Discussions

threeme3 wrote 08/17/2020 at 16:42 point

Roel, 

Congrats on these very impressive  performance figures.

For your reference here are a few test on a 16MHz ATMEGA328P compiled with latest Arduino IDE:

- 10*sieve(), with size=768 -> time=25ms  (could not increase size further due to memory restrictions)

- 10*fib(24) -> time=1340ms

Looking forward to build the K2 when you think the time is right.

Guido

  Are you sure? yes | no