Re: Euphoria Vs. VC++ Benchmark
- Posted by Jason Leit <jasonleit at HOTMAIL.COM> Jun 19, 2000
- 467 views
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