1. RE: Contest Update (12-Nov-2004)
- Posted by Chris Bensler <bensler at nt.net> Nov 12, 2004
- 495 views
- Last edited Nov 13, 2004
Pete Lomax wrote: > > > On Fri, 12 Nov 2004 01:56:09 -0800, Derek Parnell > <guest at RapidEuphoria.com> wrote: > > >A last minute entry by Ricardo Forno has made me update it again. He is > >*so* close to getting top billing again. > OUCH! That's voodoo, he could have picked something other than 10.05. > Ever get the feeling you're just being toyed with? > > Think I'll go and sulk now ;-(( > > Erm, anyway, I tried something different and got far worse than > expected results. I narrowed it down to something like this: > > if atom(table[i][j]) then > table[i][j]=chars[1..length] > > vs: > if table[i][j]=0 then > table[i][j]=1 > > I checked, under with profile, and both the above and all other > statements in the program are executed exactly the same number of > times. > > But one of the above takes 3.8 seconds, and one 6.8 seconds. > Of course one of them creates a new sequence from a slice, whereas the > other just assigns an integer. Of course, I thought the second one > would be faster, but it ain't, by some margin. What's going on??? > > with profile_time suggests that the first version takes 0.3648 seconds > (9.6% of 3.8) and the second 0.09656 seconds (1.42% of 6.8), about the > ratio I might expect, and completely contradicting the overall > runtimes for the two programs, since they only differ in those two > lines. I've repeated this and got exactly the same results about two > dozen times in a row. Anyone got any ideas? > > Pete > The first bit of code checks the 'state' of the variable. It checks an internal flag, not the value of the variable. The second bit of code checks the value of the variable and does a comparison. Chris Bensler Code is Alchemy