2.5 speed comparison: exw vs. eu.ex vs. compiled eu.ex
- Posted by Ed Davis <ed_davis2 at yahoo.com> Nov 17, 2004
- 518 views
Just playing around a little with the new 2.5. I was curious how much slower the Euphoria-based backend interpreter is than the C-based backend. On my first test, eu.ex is about 212 times slower than exw.exe. Translating eu.ex, and then compiling with Borland C, it is only 190 times slower. This first test is my entry for Derek's contest. It is both sequence and integer intensive. My second test was a simple prime number generator. Sequences are not used, only integers. In this test, eu.ex is about 17 times slower than exw.exe. The compiled eu.ex is only about 3 times slower.
constant START = time() integer file_no procedure primes() integer n, lim, k, p, highest highest = 0 n = 1 lim = 350000 -- adjust as needed to get acceptable times 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 highest = n end if end while ? highest end procedure primes() printf(1, "Elapsed time: %f\n", time() - START) file_no=getc(0)
The final test was sieve8k.exw, found in the demo\bench directory. On this test, eu.ex is about 1284 times slower than exw.exe, and the compiled eu.ex is 1088 times slower.