1. Euphoria Vs. VC++ Benchmark

:(

I got tired of the royal proclamations of C and it's variants being faster
than Euphoria because of the new compiler being written.... so I figured
"Come on VC++! Give me your best shot!" and wrote two benchmark
applications, one in Euphoria, and one in VC++. First the Euphoria program
was written, then it was translated line-by-line into ANSI C by hand, even
comments and spaces were ported.

Not only are the VC++ source and executable smaller then the Euphoria
versions, but they're also... well, see for yourself, and read the entire
readme.txt file before starting anything, there's some info at the end of it
that'll turn you blue.....

Get it at: http://people.gojasper.com/jason/bmark.zip


Jason Leit,
Booohooohooo!!! It's *that* bad! :(:(:(:(:(:(:(:(:(:(

P.S. Rob, please tell me why the results are like this :(
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

new topic     » topic index » view message » categorize

2. Re: Euphoria Vs. VC++ Benchmark

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 message » categorize

3. Re: Euphoria Vs. VC++ Benchmark

I'm glad you looked at the benchmarks :)

On my machine I get 2600 ms for the while loops in Euphoria, and 133 ms in
C++, it's probably because of the low-end AMD K6 166Mhz I'm running :(.

You know at first I did use sequences for the array test, then when porting
the benchmarks to C++ I realised I did a foolish thing as there are no
sequences in C++ and comparing them to arrays is not fair. So I put a
poke-benchmark *and* kept the sequence benchmark in the Euphoria version,
but then I added the overall time and Euphoria thus was doing one extra
benchmark. So I took the sequence benchmark out completely.

I'm glad to see that VC++ wasn't as fast as it apeared to be on my machine
(250 times faster than Euphoria!!), but it would have mattered little since
soon we can use a C or C++ compiler to do the compilation for us anyways :)

Bar to say that I got 67 errors when first compiling the VC++ version,
and 0 when compiling the Euphoria version :)

Jason Leit,
I'm feeling much better now :)


>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

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

4. Re: Euphoria Vs. VC++ Benchmark

Robert Craig wrote:

> 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.

[Puts on "Master of the obvious" hat]

I think I should explicitly state what you implied in your message:  the size
of the interpreter is relatively less when attached to a large programs.  That
is to say, 80K + 5K of Euphoria instructions results in the interpreter being
~95% of the bound executable.  80K +  5120K of Euphoria instructions results
in the interpreter being only ~2% of the bound executable.

--
Nic (RedWord)Smith

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu