> thanks for your re-check... And I too find it absolutely
> counter-intuitive. I'll also do some more tests, and if this keeps
> true, I will go and re-write some loops...
> 
> And please: post the results of your tests!
> 
Ok ^_^

It does seem to be a triple-nested loop, but only if the outer loop is
static. I don't think you need to rewrite your loops unless they're
triple-nested loops.

I ran your scripts again, with similar results:

test
-- 10457
-- "100 / 5 / 10001"

test2
-- 16
-- "100 / 5 / 10001"

Then I ran three other scripts, with interesting results:

test3
-- 1154
-- "10001 / 101"

test4
-- 1144
-- "10000 / 100"

test5
-- 16
-- "100 / 5 / 10000"

Here are the scripts. First, yours again:
on test
  ms = the milliseconds
  
  repeat with a = 1 to 10000
    repeat with i = 0 to 99
      repeat with j = 0 to 4
        nothing
      end repeat
    end repeat
  end repeat
  
  put the milliseconds - ms
  
  put i & " / " & j & " / " & a
  
end


on test2
  
  ms = the milliseconds
  
  i = 0
  
  repeat with a = 1 to 10000
    repeat while i < 100
      j = 0
      repeat while j < 5
        j = j+1
      end repeat
      i = i+1
    end repeat  
  end repeat
  
  put the milliseconds - ms
  
  put i & " / " & j & " / " & a
  
end 

and the three I wrote:

on test3
  ms = the milliseconds
  
  repeat with i = 0 to 10000
    repeat with j = 0 to 100
      
    end repeat
  end repeat
  
  put the milliseconds - ms
  
  put i & " / " & j 
  
end

on test4
  
  ms = the milliseconds
  
  i = 0
  
  repeat while i < 10000
    j = 0
    repeat while j < 100
      j = j+1
    end repeat
    i = i+1
  end repeat  
  
  put the milliseconds - ms
  
  put i & " / " & j
  
end 

on test5
  
  ms = the milliseconds
  
  i = 0
  a = 0
  
  repeat while a < 10000
    repeat while i < 100
      j = 0
      repeat while j < 5
        j = j+1
      end repeat
      i = i+1
    end repeat 
    a = a + 1
  end repeat
  
  put the milliseconds - ms
  
  put i & " / " & j & " / " & a
  
end 

Cordially,

Kerry Thompson

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to