Algorithm time...
Mike Bonner
bonnmike at gmail.com
Sun Dec 9 11:33:40 EST 2012
DOH 100k lines takes 800+ millisec. Me and my brain don't always talk.
On Sun, Dec 9, 2012 at 8:55 AM, Mike Bonner <bonnmike at gmail.com> wrote:
> Heres one more possibility.. If it doesn't matter which duplicate is used
> if there are duplicates then the following will do 100k lines in 167
> millisec. This is using google, sorry if the blasted asterisks show up.
> (To clean up yours, pasted to a field and replaced * with empty but its
> still a pain in the tookus) BTW, the search and replace in the script
> editor seems to choke when trying to replace all with an empty string.
>
> *on* mouseUp
>
> *lock* screen
>
> *put* the milliseconds into startTime
>
> *put* the number of lines of fld mydataNew into tcount
>
> *put* fld mydataNew into gbmem
>
> *set* the itemdelimiter to tab
>
> *repeat* 1000 times -- could change this to a function of the number
> of lines/groupsize
>
> *put* line 1 to 10 of gbmem into ttemp
>
> *delete* line 1 to 10 of gbmem
>
> *sort* tTemp numeric ascending by item 2 of each
>
> *put* line 1 of tTemp & cr & (the last line of tTemp) & cr aftertData
>
> *end* *repeat*
>
> *delete* the last char of tData
>
> *sort* tData numeric ascending by item 1 of each
>
> *filter tData without empty*
>
> *put* tData into field 2
>
> *put* the milliseconds into endTime
>
> *put* endTime - startTime
>
> *unlock* screen
>
> *end* mouseUp
>
>
> On Sun, Dec 9, 2012 at 7:59 AM, Michael Kann <mikekann at yahoo.com> wrote:
>
>> Glen,
>> In your example do you use the numbers in the left column for anything?
>> Are they just the line numbers?
>>
>> Mike
>>
>>
>>
>> Example:
>>
>> 1 23
>> 2 12
>> 3 9
>> 4 77
>> 5 2
>> 6 13
>> 7 44
>> 8 83
>> 9 2
>> 10 37
>>
>> In this example the result would be **Note if one or more values are the
>> min or max the the first value found can be used
>>
>> 5 2
>> 8 83
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
More information about the use-livecode
mailing list