RE : [haXe] [Flash] Benchmarking haXe

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RE : [haXe] [Flash] Benchmarking haXe

David Elahee

Hi
This pb is recurrent over compilers. Usual answer is always use randoms, lots of ops and averages.
Cheers.

Le 19 mai 2011 08:51, "Joe Dohn" <[hidden email]> a écrit :

Hi!

I've been trying to time tiny things like Std.int, or the use of modulo. The problem is that haXe compiler is so good that it simplifies what I put in my for loop and my test becomes irrelevant.

How do you guys do when you want to see how fast is some instruction?

for (i in 0...5000000)
{
    i % 123;
    // or "Std.int(i / 123)"
}

This takes as much time as an empty loop. I doubt such operations as % and / are that fast, so I suppose the compiler is a smartypants and notices that I'm doing nothing real here?

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: RE : [haXe] [Flash] Benchmarking haXe

MarcWeber
Excerpts from David Elahee's message of Thu May 19 12:56:36 +0200 2011:
> This takes as much time as an empty loop. I doubt such operations as % and /
> are that fast, so I suppose the compiler is a smartypants and notices that
> I'm doing nothing real here?
If you don't know try it: Compile two times and compare results.. If
results are the same than the compiler was smart.
Should not take more than 30 sec to find out.

Marc Weber

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: RE : [haXe] [Flash] Benchmarking haXe

Joe Dohn
I tried it, played dumb and dumber with the compiler and he won. So my benchmarks should be reliable now. Thankies, I should have thought of this trick by myself ;)

--
haXe - an open source web programming language
http://haxe.org