Re: Euphoria Vs. VC++ Benchmark

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jason Leit writes:

> P.S. Rob, please tell me why the results are like this :(

Thanks for the benchmarks.
I tried them on my machine (using the Euphoria interpreter)
and found the following:

Euphoria  while loops: 435 ms
fully optimized C++ while loops: 158 ms
C++ is 2.8x faster

Euphoria  array init: 1459 ms
fully optimized C++ array init: 298 ms
C++ is 4.9x faster

However, in C++ you have:
for(i = 0;i < 100;i++)
     foo[i] = i;
and you claim that that's equivalent to:
for i = 1 to 100 do
    poke(foo3+(i*4),i)
end for
in Euphoria. Why not write the more obvious:
for i = 1 to 100 do
    foo[i] = i
end for
in Euphoria? You could create foo as:
sequence foo
foo = repeat(0, 100)
instead of allocating memory.
When written this way Euphoria takes only 769ms.
So the ratio is just 2.6.
(And note that sequences are much
more general than simple C arrays)

On the 6 other benchmarks, C++ took 0 ms.
That's because they are very small, very artificial
benchmarks, that don't compute anything useful.
The C++ compiler can see at compile-time that nothing
useful is computed, so it deletes all the code.

You have to be careful when setting up small artificial
benchmarks with C/C++. For example, if you don't print
or somehow use, the result of a calculation, the compiler
might just delete all the code used in calculating that result.
That's very clever, but rarely helps in a real program.

You used Euphoria 2.0 to bind.
If you bind with Euphoria 2.2
the .exe size will drop from 150K down to 79K since
exw.exe is now compressed.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu