L1VM - benchmark 04

Now I wrote a double floating point add numbers benchmark. It has programs for L1VM, Inko VM, Python, Lua, Node.js and C.

Update: I did add the result of my new compiler math optimization. Now the L1VM is a little faster as Node.js! Here are the results:

Double floating point benchmark
===============================
Programs for L1VM, Inko VM, Python, Lua, Node.js and C.
Results are sortet by runtime.

Inko VM
=======
Build:
$ ivm run latest inko build double-test.inko

Run:
$ ivm run latest inko double-test.ibi

Loop passes: 10000000

Inko VM
=======
$ time ivm run latest inko double-test.ibi
start...
8800000881.0
exit!

real	0m46,494s
user	0m54,296s
sys	0m1,447s


Python
======
$ time python double-test.py
start...
8800000881.0

real	0m13,416s
user	0m13,394s
sys	0m0,008s


Lua
===
$ time lua double-test.lua
start...
8800000881.0

real	0m5,291s
user	0m5,284s
sys	0m0,002s


Node.js
=======
$ time node double-test.js
start...
8800000881

real	0m2,867s
user	0m2,880s
sys	0m0,068


L1VM
====
$ time l1vm prog/double-test-optimized -q
8800000881.0000000000

real	0m2,364s
user	0m2,331s
sys	0m0,009s


C
=
$ time ./double-test
8800000881.0000000000

real	0m0,528s
user	0m0,523s
sys	0m0,001s

I did write a version of the benchmark with inline assembly and JIT-compilation for my L1VM:

L1VM - inline assembly and JIT-compiler
=======================================
$ time l1vm double-test-jit -q
JIT-compiler compile time: TIMER ms: 0.3590000000
8800000881.0000000000

real	0m0,540s
user	0m0,532s
sys	0m0,007s

UPDATE: as you can see I know measured the JIT-compilation time: which is 0.359 ms! The L1VM program runs at C speed and the JIT-compiler is very fast!

Here is the archive with all programs included: L1VM-benchmark-double-add-04

Here is the optimized L1VM program in Brackets:

// double-test-optimized.l1com
//
// (no-var-pull-on) (no-var-pull-off) optimization demo
//
(main func)
    (set int64 1 zero 0)
    (set double 1 zerod 0.0)
    (set double 1 x 23.0)
    (set double 1 y 42.0)
    (set int64 1 max 10000000Q)
    (set int64 1 loop 0)
    (set int64 1 one 1)
    (set double 1 count 1.0)
    (set int64 1 f 0)
    (optimize-if)
    (:loop)
    (no-var-pull-on)

    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}

    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}
    {count = (count + x)}

    {count = (count + y)}
    {count = (count + y)}
    {count = (count + y)}
    {count = (count + y)}
    {count = (count + y)}

    {count = (count + y)}
    {count = (count + y)}
    {count = (count + y)}
    {count = (count + y)}
    {count = (count + y)}

    (no-var-pull-off)
    ((count zerod +d) count =)

    ((loop one +) loop =)
    (((loop max <=) f =) f if)
        (:loop jmp)
    (endif)

    (5 count 0 0 intr0)
    (7 0 0 0 intr0)
    (255 0 0 0 intr0)
(funcend)