Re: Efficiency question for list modification

2011-03-16 Thread Peter Brigham MD
On Mar 12, 2011, at 6:13 PM, Alex Tweedly wrote: You're right. Sorry - I was misled by the docs, which describe the order of the combine following the description of the 'first' form of the combine command, and then go on to describe the second form, including the fact that the keys of the

Re: Efficiency question for list modification

2011-03-12 Thread Alex Tweedly
You're right. Sorry - I was misled by the docs, which describe the order of the combine following the description of the 'first' form of the combine command, and then go on to describe the second form, including the fact that the keys of the array must be all numeric. I put 2 + 2 together and

Re: Efficiency question for list modification

2011-03-12 Thread Bob Sneidar
This has been a sore point for me concerning arrays. You should at least expect the array to be sorted by when the element was created. That way you could see the most recent items by looking at the last elements first, like Filemaker. Unsorted, you can always depend on seeing the last records a

Re: Efficiency question for list modification

2011-03-12 Thread Alex Tweedly
"newer", but not "new" :-) 'split by column' and 'split by row' appeared somewhere around 3.5 (I think) -- Alex. On 12/03/2011 01:11, Bob Sneidar wrote: Wha?? There is a newer form of split and combine?? Bob On Mar 11, 2011, at 4:42 PM, Alex Tweedly wrote: FlexibleLearning wrote: This i

Re: Efficiency question for list modification

2011-03-12 Thread FlexibleLearning
Summary: We are trying to divide pairs of comma-delimted items in a return-delimited list by two different numbers. >Use "split by column" to separate the two columns >Then use "split by row" to convert the columns into arrays >Then use "divide by " to do the maths >Then combine them back again.

Re: Efficiency question for list modification

2011-03-11 Thread Bob Sneidar
Wha?? There is a newer form of split and combine?? Bob On Mar 11, 2011, at 4:42 PM, Alex Tweedly wrote: > >> FlexibleLearning wrote: >> >>> This is BAD... >>> repeat for each line L in tData >>> add 1 to n >>> put (item 1 of L/div1) into item 1 of line n of stdout >>> put (item

Re: Efficiency question for list modification

2011-03-11 Thread Alex Tweedly
FlexibleLearning wrote: This is BAD... repeat for each line L in tData add 1 to n put (item 1 of L/div1) into item 1 of line n of stdout put (item 2 of L/div2) into item 2 of line n of stdout end repeat The use of "put ... after ..." is so efficient this may be an intere

Re: Efficiency question for list modification

2011-03-11 Thread Bob Sneidar
hmmm interesting, concatenation is much better than enumeration. Whoda think it? I will keep that in mind for large data sets. Thanks for the info! Bob On Mar 11, 2011, at 3:24 AM, FlexibleLearning wrote: > Proof of how optimized syntax can make an enormous difference to speed (by > orders of

Re: Efficiency question for list modification

2011-03-11 Thread Richard Gaskin
FlexibleLearning wrote: > Proof of how optimized syntax can make an enormous difference to speed (by > orders of magnitude in this case). > > This is BAD... > repeat for each line L in tData > add 1 to n > put (item 1 of L/div1) into item 1 of line n of stdout > put (item 2 of L/div

Re: Efficiency question for list modification

2011-03-11 Thread FlexibleLearning
Proof of how optimized syntax can make an enormous difference to speed (by orders of magnitude in this case). This is BAD... repeat for each line L in tData add 1 to n put (item 1 of L/div1) into item 1 of line n of stdout put (item 2 of L/div2) into item 2 of line n of stdout end

Re: Efficiency question for list modification

2011-03-10 Thread Jim Ault
Of course, using a faster processor would give faster results. What would be the speed difference if the data block was sent to an irev script and run on a faster processor? Jim Ault Las Vegas On Mar 10, 2011, at 12:07 PM, Alex Tweedly wrote: use repeat for each line L ... and collect the mo

Re: Efficiency question for list modification

2011-03-10 Thread Nonsanity
On Thu, Mar 10, 2011 at 4:40 PM, Bob Sneidar wrote: > How about chunking the data with the new method? I would put money on the > notion that it won't matter much. > > Bob > It didn't. :) ~ Chris Innanen ~ Nonsanity ___ use-livecode mailing list u

Re: Efficiency question for list modification

2011-03-10 Thread Bob Sneidar
How about chunking the data with the new method? I would put money on the notion that it won't matter much. Bob On Mar 10, 2011, at 1:25 PM, Nonsanity wrote: > I didn't use that style because he mentioned he tried it without much > success. I tried it down on the straight-up 100,000 pass and

Re: Efficiency question for list modification

2011-03-10 Thread Nonsanity
I didn't use that style because he mentioned he tried it without much success. I tried it down on the straight-up 100,000 pass and it finished in 4 seconds. Hands down the fastest. I should have tried that on my own just for completeness' sake. I guess I was too taken with the faster results I got

Re: Efficiency question for list modification

2011-03-10 Thread Bob Sneidar
You should also try using the form: repeat for each line theLineValue in theData Apparently this creates an internal array of theData and is much faster. The big caveat is that you do not alter what theData contains while in the repeat loop, as this will really screw things up. That is because

Re: Efficiency question for list modification

2011-03-10 Thread Alex Tweedly
use repeat for each line L ... and collect the modified lines in a separate variable, replace the original variable after the loop repeat fer each line L in tData put ... & CR after temp end repeat put temp into tData should be very quick. -- Alex. btw - not needed in this case, but you cou

Re: Efficiency question for list modification

2011-03-10 Thread dunbarx
e@lists.runrev.com Sent: Thu, Mar 10, 2011 2:18 pm Subject: Re: Efficiency question for list modification I ran this with a field "rawData" containing 5000 lines: on mouseUp put the ticks into aa put fld "rawdata" into temp put 3 into div1 put 5 into div2 r

Re: Efficiency question for list modification

2011-03-10 Thread Nonsanity
I made a quick test stack to try out a few ides: http://dl.dropbox.com/u/144280/Divide%20List%20Tests.livecode It generates 100,000 random integer pairs into one field, then has four buttons to do the sample division you gave to the two items in each line. The first is a straight-up "repeat

Re: Efficiency question for list modification

2011-03-10 Thread stephen barncard
perhaps find a way to speed up the other code inside that is parsing and doing the math. can't you add an index (id) column to the data? even temporarily? therefore create the arrays in a way where you can restore the original order. On 10 March 2011 10:51, FlexibleLearning wrote: > Problem: >

Re: Efficiency question for list modification

2011-03-10 Thread dunbarx
numbered: If you had: 3,6 4,7 5,8 Make it into: 1,3,6 2,4,7 3,5,8 Now you can use an array, and the ordering can be recovered since the lines contain unique identifiers. Craig Newman -Original Message- From: FlexibleLearning To: use-livecode@lists.runrev.com Sent: Thu, Mar 1

Efficiency question for list modification

2011-03-10 Thread FlexibleLearning
Problem: I have a long list of several thousand lines. Each line contains two comma-separated numbers. I want to divide the first item of each line by one divisor, and divide the second item of each line by a different divisor. The list order must stay the same. Example: Using 2 and 5 as divisors.