Friday, May 23, 2008

Threaded Execution in the Ngaro VM

Thanks to Matthias Schirm there's a new implementation of Ngaro. It's written in C, and supports the text console devices. His implementation uses threaded execution, which is faster. He is working on further performance improvements. (This will likely become the default console build later this summer.) At present it does not work with the SDL-backed I/O; I will try to figure out why later on.

I've not done any significant benchmarking, but he did provide some numbers:
  : test dup for dup . CR 1 – next ; 1000000 test bye
ngaro (old):
  real  [s] 35,47
user [s] 8,27
sys [s] 1,07
ngaro (new):
 real: [s]  35,13
user [s] 7,46
sys [s] 1,34

  : fib dup 1 >if dup 1 RECURSE swap 2 RECURSE + EXIT then drop 1 ; 39 fib bye

ngaro (old):
 real  [s]  131,23
user [s] 131,21
sys [s] 0,03

ngaro (new):
 real  [s]  77,95
user [s] 77,67
sys [s] 0,04

This is a clear improvement and should continue to get better. I've begun to work on a small benchmark package; once done it'll be easier to test performance tweaks.

No comments: