Setting hidden of lines very slow
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
repeat with i = 1 the number of lines of fld 1
set the hidden of line i of fld 1 to false
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
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
> 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
> 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"]["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:
More information about the Use-livecode