Hi Dick, I have adjusted your routine so it reports back the values from the original dataset... note the "x" factor that has been added.
Also, for 50,000 data points I was doing approximately 9 seconds with your routine it now is in the low milliseconds!! Now I have to really review and understand how your routine works. thanks, Glen On Sun, Dec 9, 2012 at 5:26 AM, Dick Kriesel <[email protected]> wrote: > > On Dec 9, 2012, at 12:33 AM, Glen Bojsza wrote: > > > I believe that this should be doable less than 1 second > > Hi, Glen. Here's a draft you could try. It works for the sample data you > posted. > > If you have questions, please ask. If you try it, please report your > timings. > > -- Dick > > > > <postScript> > function foo @pLines > put 0 into x > put the number of lines in pLines div 1000 into tGroupSize > set the itemDelimiter to tab > repeat for each line tLine in pLines > add 1 to tLineNumber > put item 2 of tLine into tValue > if tIndex[ tValue ] is empty then > put tLineNumber into tIndex[ tValue ] > end if > if tLineNumber is tGroupSize then > put the keys of tIndex into tValues > replace cr with comma in tValues > put min( tValues ) into tMin > put max( tValues ) into tMax > if tIndex[ tMin ] < tIndex[ tMax ] then > put tIndex[ tMin ] + x & tab & tMin & cr after tResult > put tIndex[ tMax ] + x & tab & tMax & cr after tResult > else > put tIndex[ tMax ] + x & tab & tMax & cr after tResult > put tIndex[ tMin ] + x & tab & tMin & cr after tResult > end if > put empty into tIndex > put 0 into tLineNumber > *put* x + tGroupSize into x > end if > end repeat > return tResult > end foo > </postScript> > _______________________________________________ > use-livecode mailing list > [email protected] > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
