Re: simple eurphoria question

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

Chris Bensler wrote:
> 
> Ricardo M. Forno wrote:
> > 
> > Chris Bensler wrote:
> > > 
> > > Ricardo M. Forno wrote:
> > > > Yep, you are right.
> > > > I performed the following test of candidate good functions for this
> > > > task.
> > > > The results showed all three were correct, but f2 was the fastest:
> > > 
> > > Did you try changing the order of the code in your bench tests, to verify
> > > that
> > > it wasn't affecting your results? I've found it to be a major factor in
> > > any
> > > kind of trivial timing test.
> > > 
> > > Also, it should be slightly faster if the last return statement in f2()
> > > was
> > > inside of an if-branch..
> > > As Matt (I beleive) pointed out with his winning code from the christmas
> > > contest
> > > a few years ago.
> > > 
> > > }}}
<eucode>
> > > function f2(atom a)
> > >   if a < 0 then
> > >     return - floor(- a)
> > >   else
> > >     return floor(a)
> > >   end if
> > > end function
> > > </eucode>
{{{

> > > 
> > > Chris Bensler
> > > ~ The difference between ordinary and extraordinary is that little extra ~
> > > <a href="http://empire.iwireweb.com">http://empire.iwireweb.com</a> -
> > > Empire
> > for Euphoria</font></i>
> > 
> > Hi Chris.
> > I tested both versions before posting this mail,
> > with the return inside the if and outside it.
> > Both had identical timings.
> > 
> > Regarding the code order, what change would you suggest?
> > Regards.
> 
> Sorry, nevermind the code order. I can't duplicate the results.
> 
> However, it's worth mentioning that in my bench tests, f1() was consistently
> faster than f2() when using exw3.0.1 and f2() is faster than f1() when using
> exw2.3
> Either way, the difference is so marginal that I don't think it matters.
> 
> Chris Bensler
> ~ The difference between ordinary and extraordinary is that little extra ~
> <a href="http://empire.iwireweb.com">http://empire.iwireweb.com</a> - Empire
> for Euphoria

Hi Chris.
Maybe there should be some difference between your benchmarks and mine.
My PC has an AMD 2800 chip, and I'm usig EU 2.4 :)
Regards.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu