Setting hidden of lines very slow

Tom Glod tom at makeshyft.com
Sat Dec 1 13:23:24 EST 2018


Can someone explain the seemingly extraordinary performance improvement in
using apparently its "split second" vs "over a minute"

set the hidden of line 1 to - 1 of field 1 to false

vs.

repeat with i = 1 the number of lines of fld 1
      set the hidden of line i of fld 1 to false
end repeat

it doesn't seem like the loop would be the bottleneck here, but rather the
work on the field itself....but obviously, I know nothing about this engine
:D

Thanks,



On Sat, Dec 1, 2018 at 9:40 AM hh via use-livecode <
use-livecode at lists.runrev.com> wrote:

> > Kaveh wrote:
> > I can confirm that the htmltext method works beautifully and blindingly
> fast.
>
> So we have here two methods:
> The htmlText-method and the styledText-method.
>
> There is an interesting result in the speed comparison of the two methods.
>
> Here the htmlText-method is significantly faster with less than at about
> 1500 short lines, between 1500 and 2500 short lines speed is at about the
> same, for more than at about 2500 short lines the styledText-method becomes
> significantly faster.
>
> As LC flattens any nested arrays the styledText-method is probably
> adjustable
> and worth the loop through the runs: styledText experts please come in.
>
> ## HtmlText-method for any colored text chunk in the line.
> on mouseUp
>   put the millisecs into m1
>   lock screen; lock messages
>   set linedelimiter to "<p"
>   put the htmltext of fld 1 into ht
>   replace " hidden" with empty in ht
>   repeat for each line L in ht
>     if offset("color=",L)>0 then put "<p" & L after s
>     else put "<p hidden" & L after s
>  end repeat
>  set htmltext of fld 1 to s
>  put the millisecs-m1 into fld "timing"
> end mouseUp
>
> ## StyledText-method for a whole colorized line.
> put the styledText of field "text" into tTextA
> # loop through paragraphs
> repeat with i = 1 to the number of elements of tTextA
>   # Check if first run has textcolor set
>   put (tTextA[i]["runs"][1]["style"]["textcolor"] is empty) \
>       into tTextA[i]["style"]["hidden"]
>   end if
> end repeat
> set the styledText of fld "text" to tTextA```
>
>
>
> _______________________________________________
> 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