Need to filter out items of list
Geoff Canyon
gcanyon at gmail.com
Tue Jun 3 18:31:54 EDT 2014
As always, YMMV.
I created a stack with two fields. Ran this script once:
on mouseUp
repeat with i = 1 to 150000
repeat 20
if random(4) > 1 then put random(100) - 30 after R
put tab after R
end repeat
put cr into char -1 of R
end repeat
put R into fld 1
end mouseUp
Then ran this script -- it reports less than 0.2 seconds for the actual
filtering:
on mouseUp
set the itemdel to tab
put the long seconds into T
repeat for each line L in fld 1
if item 9 of L is empty or item 15 of L < 0 then next repeat
put L & cr after R
end repeat
put the long seconds - T
put R into fld 2
end mouseUp
If you have enough data or a slow enough computer to need to report on
progress, then you can use this (I added a third field):
on mouseUp
set the itemdel to tab
put the long seconds into T
put the seconds into S
put 0 into C
repeat for each line L in fld 1
add 1 to C
if the seconds <> S then
put C into fld 3
wait 0 seconds
put the seconds into S
end if
if item 9 of L is empty or item 15 of L < 0 then next repeat
put L & cr after R
end repeat
put the long seconds - T
put C into fld 3
put R into fld 2
end mouseUp
On Tue, Jun 3, 2014 at 3:00 PM, Dar Scott <dsc at swcp.com> wrote:
> Did you try every so often? To do that, check for ‘i mod 1000 = 0’ or the
> like. There might be a faster way, but that works.
>
> Dar
>
>
> On Jun 3, 2014, at 1:23 PM, Magicgate Software - Skip Kimpel <
> skip at magicgate.com> wrote:
>
> > Yep, just tried it and the counter slowed down the process in a VERY
> > noticeable way. I will have to evaluate if it is worth it or not.
> >
> > SKIP
> >
> >
> > On Tue, Jun 3, 2014 at 3:17 PM, J. Landman Gay <jacque at hyperactivesw.com
> >
> > wrote:
> >
> >> On 6/3/2014, 2:02 PM, Magicgate Software - Skip Kimpel wrote:
> >>
> >>> Given that I have about
> >>> 150,000 rows of data to process I am going to need to create some type
> of
> >>> progress bar or counter.
> >>>
> >>
> >> Try it first without one, you might be surprised. The "repeat for each"
> >> construct is very fast.
> >>
> >> One time I added a progress bar out of habit because I had so many lines
> >> to process. It took about 15 seconds to go through the whole loop. When
> I
> >> removed the progress bar, the loop completed in two or three seconds. It
> >> turned out that updating the progress bar took more time than the entire
> >> rest of the loop.
> >>
> >> So see if the progress bar is really worth the overhead. If it's just a
> >> little slow, consider setting the cursor to a watch instead so the user
> >> knows something is happening. That has no overhead. Or if you do need a
> >> progress bar, only update it every 10th or 50th iteration or so.
> >>
> >> --
> >> Jacqueline Landman Gay | jacque at hyperactivesw.com
> >> HyperActive Software | http://www.hyperactivesw.com
> >>
> >>
> >> _______________________________________________
> >> 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
> >>
> > _______________________________________________
> > 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
>
>
> _______________________________________________
> 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