Sorting text is *VERY* slow in LC9 on Windows (Re: Accumulating text is *VERY* slow in LC9 on Windows)

Mark Waddingham mark at
Thu Sep 2 13:38:52 EDT 2021

On 2021-08-30 20:22, Ben Rubinstein via use-livecode wrote:
> Thanks to Mark Waddingham's advice about using a buffer var when
> accumulating a large text variabel in stages, I've now got a script
> that took 8 hours under LC9, and (8 minutes under LC6) down by stages
> to just under 1 hour under LC9.
> Has anyone else noticed something of this sort? As I said, the effect
> varies: e.g. 54 seconds versus 1 second; 22 seconds versus 1 second.
> So it may not be so noticeable in all cases.

It will undoubtedly be the same problem as your accumulation slowness - 
as the sort routines use (essentially) `put after` to reconstruct the 
string after sort. So fixing the accumulation slowness will fix sort.

Indeed, there's a further optimization to be had in sort now I come to 
think of it (probably relatively minor after the accumulation problem is 
sorted) - the sorted buffer size (in chars) will be the same as the 
input buffer size as its just a permutation of the lines - so the output 
buffer can be pre-allocated at the right size.

We will endeavour to fix for 9.6.5-rc-1 (due 'real soon now'!).

Warmest Regards,


Mark Waddingham ~ mark at ~
LiveCode: Everyone can create apps

More information about the use-livecode mailing list