Re: Interesting benchmark results - Euphoria vs. Euphoria
- Posted by ed_davis May 21, 2014
- 2602 views
Hi Ed,
I finally finished my virtual machine interpreter, started back in December when you published that primes benchmark. I now have it working on the primes and this new benchmark. The interpreter is written in C and is register-based (instead of stack-based), and it goes really fast. The parser and bytecode compiler is written in Euphoria and it supports only a small subset of Euphoria statements, mainly integer arithmetic and loops. If you don't mind, could you benchmark it on your machine and let me know how it stacks up? The source code is here: https://github.com/peberlein/interpreter
Hello Pete!
It has been a long time since PEU! I still have peu08 from August 1998.
Your new interpreter looks really promising. But (sorry about that), I had a problem with while loops. I could not get bench.ex or primes.ex to run - they both crashed. I traced it down to the while loop. For instance, this appears to work:
integer pc, k, p, lim, n lim = 5000000 n = 1 pc = 0 --while n < lim do k = 3 p = 1 n = n + 2 -- while k * k < n and p do p = floor(n / k) * k != n k = k + 2 -- end while if p then pc = pc + 1 end if --end while ? pc
But this crashes:
integer i i = 0 while i < 10 do i = i + 1 ? i end while
The above generated:
00000101 0: load r1, 0 000A0201 1: load r2, 10 0301020A 2: jle r2, r1, 3 (6) 01010105 3: addu8 r1, r1, 1 00000114 4: qprint r1 FFFB000D 5: jmp -5 (1) 00000000 6: end
I'm running Windows 7. I'm using: gcc (tdm64-2) 4.8.1
I compiled interpret.c with:
-m32 -O3 -march=native -mtune=native
I also tried it with:
-m64 -O3 -march=native -mtune=native
I also tried it without any options, save forcing 32-bit/64-bit compilation:
-m32
and
-m64
Let me know if there is something you'd like me try.