Speed problems when cloning a group lots of times

Ian Wood revlist at azurevision.co.uk
Mon Jul 7 09:21:56 EDT 2008

OS X 10.5.2
Rev Studio 2.9.0 Build 610

As part of a geotagging app, I need to generate scrolling lists of GPS  
coordinates, other info and 'reveal in Google Earth' buttons.  
Potentially the user will do this for thousands of images at once,  
although 50-300 at a time will be more likely.

I figured the easiest way to do this would be to copy a group  
containing one lines-worth of controls and then paste it lots of  
times. Unfortunately the amount of time it takes to paste is  
increasing as the repeat loop goes on, AND Rev is then unresponsive  
for several seconds for larger (300+) numbers of lines.

100 lines = 800ms plus 1s freeze
200 lines = 3s plus 3s freeze
400 lines = 10s plus 19s freeze

In a standalone, speed increases to about 1 millisecond per line and  
the unresponsiveness goes, but go above ~500 lines and it suddenly  
starts slowing down again:

100 lines = 50ms
200 lines = 120ms
400 lines = 480ms
500 lines = 870ms
600 lines = 1.5s
700 lines = 2.6s
1000 lines = 8s

Any ideas, or alternative approaches? Cloning the original group makes  
no difference to speed, and adds in all sorts of problems with 'last  
group' not giving the expected result.

Here's the code:

on mouseUp
     put the milliseconds into tt
     put text of fld "number" into tNum
     lock screen
     if there is a grp "list scroller" then delete grp "list scroller"
     put 50 into tTop
     put 8 into tGap
     put 1 into tCount
     copy grp "list master"
     repeat tNum times
         set the cursor to busy
         put long id of last grp into tGrp
         set name of last grp to ("version" && tCount)
         set top of last grp to tTop + tGap
         set visible of last grp to true
         add height of last grp to tTop
         add 1 to tcount
         put tGrp & return after tGrpList
     end repeat

     delete last char of tGrpList

     put "group " into tComm
     repeat for each line tgrp in tGrpList
         put tGrp && "and " after tComm
     end repeat
     delete last word of tComm
     do tComm -- most reliable way of grouping the new groups

     put long id of second grp into tGrp
     select empty
     set name of tgrp to "list scroller"
     set height of tGrp to 300
     set top of tGrp to 100
     set width of tgrp to 16 + formattedwidth of tGrp
     set the vscrollbar of tgrp to true
     answer the milliseconds - tt

end mouseUp


More information about the use-livecode mailing list