Re: Efficient code for accessing the items (or lines) in a variable.

2011-02-20 Thread Colin Holgate
On Feb 20, 2011, at 8:29 PM, Alex Tweedly wrote: > added the highlighted lines below, and then re-ran your tests > >as-is using item >> >> foreach85 159 >> repeatwith 93 3102 >> countarray 276 367 I added them in mine too. I had to decr

Re: Efficient code for accessing the items (or lines) in a variable.

2011-02-20 Thread Alex Tweedly
On 20/02/2011 17:13, Colin Holgate wrote: I just did some timing tests, partly to see if using an array might help with speed. It didn't, but in doing the test I thought of a neater way of testing than I've done before. Usually my testing would resemble this: ... Then I would type in "onew

Re: Efficient code for accessing the items (or lines) in a variable.

2011-02-20 Thread Alex Tweedly
Hmmm, no you can't use if tItem is empty then exit repeat end if because it is perfectly feasible to have empty items within the middle of the data. You would need to use if tOffset > the number of chars in tData then exit repeat or something like that. I'm not sure whether this w

Re: Efficient code for accessing the items (or lines) in a variable.

2011-02-20 Thread Colin Holgate
I just did some timing tests, partly to see if using an array might help with speed. It didn't, but in doing the test I thought of a neater way of testing than I've done before. Usually my testing would resemble this: on oneway put the milliseconds into t repeat with a = 1 to 1

Re: Efficient code for accessing the items (or lines) in a variable.

2011-02-20 Thread Dick Kriesel
On 2/19/11 4:44 PM, "Alex Tweedly" wrote: >> put 1 into tCurrentItemCharOffset >> repeat with i = 1 to the number of items in tData >> ... item 1 of (char tCurrentItemCharOffset to -1 of tData) ... >> add the number of chars in item 1 of (char tCurrentItemCharOffset >> to -1 of tData) +

Efficient code for accessing the items (or lines) in a variable.

2011-02-19 Thread Alex Tweedly
The other day I mentioned the great efficiency that can be gained by using the form repeat for each item tItem in tdata tItem ... end repeat rather than the (perhaps more obvious) repeat with i = 1 to the number of items in tdata item i of tData ... end repe