Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-11 Thread Bob Sneidar
If you are talking about recursion, that is having a function call itself, be aware that there is a limit to recursion. But I don’t think that is what you are asking. The repeat structure is pretty damned efficient already. For repeats of a fixed number where your script doesn’t need the count

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-11 Thread J. Landman Gay
On 2/11/14, 9:48 AM, Bob Sneidar wrote: For small tasks though, your users will not even be able to blink before 100,000 simple repeats are executed. I ran a 100,000 count loop with nothing in the repeat loop to do and it took 1 tick. ONE TICK! The repeat loop is NOT what slows things down! Wel

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-13 Thread Bob Sneidar
Aye, but the question was which form of repeat was more efficient. In fact your example proves the point which is, it’s the actual code inside the repeat loop that takes way more time than the form of repeat itself. What would really be of interest is comparing the form repeat for each word th

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-13 Thread J. Landman Gay
On 2/13/14, 8:53 PM, Bob Sneidar wrote: Aye, but the question was which form of repeat was more efficient. I thought you said that any repeat loop was equal to another, and just pointed out that an empty loop (your original test) didn't mean much until you put some code in it. It's pretty w

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-13 Thread J. Landman Gay
Oops. That reads way snarkier than it sounded in my head. Sorry. On 2/13/14, 10:12 PM, J. Landman Gay wrote: On 2/13/14, 8:53 PM, Bob Sneidar wrote: Aye, but the question was which form of repeat was more efficient. I thought you said that any repeat loop was equal to another, and just pointe

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-14 Thread Geoff Canyon
> On Feb 13, 2014, at 11:12 PM, "J. Landman Gay" > wrote: > > It's pretty well established that the "for each" form is a magnitude faster > than the counting form. Nitpicking, but "[order of] magnitude" doesn't come close to covering the efficiency. The example Bob gave, since there were onl

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-15 Thread Geoff Canyon
For anyone who cares, I re-wrote Bob's code to handle a variable-length string like so: on mouseUp put 10 into wc repeat with i = 1 to wc put i & space after tData end repeat put the ticks into line one of theTime repeat 100 div wc repeat with j = 1 to wc

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-16 Thread Bob Sneidar
I did not think “snarky” when I read your post. Whenever discussing technical things, it probably always sounds snarky. I’ve second guessed some of my own posts for that reason, But no fear, I take everything I read on this list from long time posters as what it is: Expert opinions from professi

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-16 Thread Bob Sneidar
Funny, just before I read your post I was thinking, “I wonder if this scales linearly or logarithmically?” GET OUT OF MY HEAD!!! ;-) Bob On Feb 15, 2014, at 07:37 , Geoff Canyon mailto:gcan...@gmail.com>> wrote: For anyone who cares, I re-wrote Bob's code to handle a variable-length string li

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-16 Thread Geoff Canyon
On Sun, Feb 16, 2014 at 2:52 PM, Bob Sneidar wrote: > Funny, just before I read your post I was thinking, "I wonder if this > scales linearly or logarithmically?" GET OUT OF MY HEAD!!! ;-) > It's pretty much my personal quest to convince everyone never to use repeat with i = 1 to the number of an

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-17 Thread Peter M. Brigham
On Feb 16, 2014, at 10:23 PM, Geoff Canyon wrote: > On Sun, Feb 16, 2014 at 2:52 PM, Bob Sneidar > wrote: > >> Funny, just before I read your post I was thinking, "I wonder if this >> scales linearly or logarithmically?" GET OUT OF MY HEAD!!! ;-) > > It's pretty much my personal quest to convin

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-17 Thread Peter Haworth
Have to admit I'm the same. If it's more convenient codingwise to to repeat with x=1 to whatever and I know for sure there won;t be many iterations to go through, the speed difference is unnoticeable to the user. I'm also curious about another aspect of this. Is it universally true that "repeat

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-17 Thread Peter M. Brigham
Time test: on testRepeat put "xxx" into line 10 of tList replace cr with "xxx" & cr in tList put the long seconds into timerStart repeat with n = 1 to 10 put line n of tList & cr after newList1 end repeat put the long seconds into timerEnd put timerEnd - timerSta

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-17 Thread Alex Tweedly
On 17/02/2014 21:50, Peter Haworth wrote: Have to admit I'm the same. If it's more convenient codingwise to to repeat with x=1 to whatever and I know for sure there won;t be many iterations to go through, the speed difference is unnoticeable to the user. I'm also curious about another aspect of

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-17 Thread Dr. Hawkins
On Sun, Feb 16, 2014 at 7:23 PM, Geoff Canyon wrote: > It's pretty much my personal quest to convince everyone never to use repeat > with i = 1 to the number of anything. > I'm frequently using put 0 into i repeat for each word theWord in someString add 1 to i end repeat as I frequently need

Re: Most Effecient way to repeat a handler/function - Found word(s) list error in the Text body

2014-02-17 Thread Geoff Canyon
On Mon, Feb 17, 2014 at 3:39 PM, Peter M. Brigham wrote: > Well, I still do [repeat with i = 1 to the number of] for i < 1000 or so, > and the speed hit is perfectly acceptable for that. The advantage for me is > when I must use the number of the iteration I'm in to do something. For all my pro