Re: Contest Update (12-Nov-2004)
Pete Lomax wrote:
>
> On Fri, 12 Nov 2004 21:39:22 +0000, Chris Bensler <bensler at nt.net>
> wrote:
>
> >The first bit of code checks the 'state' of the variable. It checks
> > an internal flag, not the value of the variable.
> Sorry, I think you *completely* misunderstood the question.
> (my fault, probably)
> The maths just on the "if" part is:
> first: 5.08% * 3.8 = 0.19304 seconds
> second: 1.08% * 6.8=0.07344 seconds.
>
> (at least that is what with profile_time repeatedly tells me)
>
> What that tells me (I need to test this I guess) is that "atom()" is
> in fact slower that "=0" (anyway).
>
> Nevertheless, if I "lost" on that test, I would accept it, but bear
> the above numbers in mind.
> >
> >The second bit of code checks the value of the variable and does a
> >comparison.
> >
> But both line 1 + line 2 together (as the only changes) account, at
> most, for 0.3648 seconds, and, in the case I think would be faster,
> but ain't, 0.09656 seconds.
>
> (again, that is what with profile_time repeatedly tells me)
>
> All other lines being equal, where has the extra *3* whole seconds of
> runtime (78%) come from?
>
> Would you be happy that changing one line from "atom()" to "=0" nearly
> doubles the runtime? If it did, would you like to know why? I do!
>
> I know you can't second-guess my code, I probably need to work on
> making a simpler case exhibit the same effect, which just may never
> have been noticed by anyone else, ever, before, but I kinda doubted,
> and hoped against that.
Just did a bit of testing myself and it shows that the use of
"if atom(table[i][j])" or "if table[i][j]=0" has no influence on
the speed. By that I mean that ...
if atom(table[i][j]) then
end if
and
if table[i][j] = 0 then
end if
take the same time (near enough).
The time is mostly taken up by ...
table[i][j]=chars[1..len]
as
table[i][j]=1
has no real influence either.
--
Derek Parnell
Melbourne, Australia
|
Not Categorized, Please Help
|
|