Recently I’ve been teaching myself PowerPC assembly through porting JONESFORTH to PowerPC on Mac OS X. It struck me to run the same little fibonacci-sequence microbenchmark that I ran lo these many years past. The results were interesting:
|Language||Implementation Detail||Time (per (fib 29) call, in milliseconds)||Ops/s||Ratio (opt. C)||Ratio (unopt. C)|
|FORTH||JONESFORTH ported to PPC||277||81096000||4.95||2.37|
The hand-coded assembly beats all the other entrants (perhaps unsurprisingly). The naive indirect-threaded FORTH is the fastest interpreted language, merely 5 times slower than fully optimised C.
Here’s the JONESFORTH code:
and here’s the PPC assembly (arg and result in