Re: simple eurphoria question

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

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.

function f2(atom a)
  if a < 0 then
    return - floor(- a)
  else
    return floor(a)
  end if
end function


Chris Bensler
~ The difference between ordinary and extraordinary is that little extra ~
http://empire.iwireweb.com - Empire for Euphoria

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

Search



Quick Links

User menu

Not signed in.

Misc Menu