Livecode performance problem

Brian Milby brian at milby7.com
Fri Aug 19 18:13:04 EDT 2022


First optimization would be to put … & cr after vCombined and then delete the trailing from when done.

Sent from my iPhone

> On Aug 19, 2022, at 5:11 PM, Paul Dupuis via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I have a set of fields, call them A, B, C, and D. Each has the same number of lines. Each field has different text (per line)
> 
> I need to combine the data - frequently - into a form that look like:
> 
> <i><tab><line i of fld A><tab><line i of fld B><tab><line i of fld C><tab><line i of fld D><cr>
> 
> For the number of lines in the set of fields. Currently I do this as follows:
> 
> put empty into vCombined
> put fld A into v1
> put fld B into v2
> put fld C into v3
> put fld D into v4
> repeat with i=1 to the number of lines in v1
>   put i &tab& line i of v1 &tab& line i of v2 &tab& line i of v3 &tab& line i of v4 into line i of vCombined
> end repeat
> 
> I put the field contents into variable before the loop to combine them as my understanding is variable access is faster than field access in a loop
> 
> My question to the Hivemind is: Is there a noticeably faster way to covert these field to the tab delimited structure as show above than the code above?
> 
> This current takes about 20 seconds for 2000 lines or about a second per 100 lines (very roughly, I was not using a timer in my code, just my wristwatch seconds in the IDE debugger between breakpoints)
> 
> Thank you for any pointers in advance,
> 
> Paul Dupuis
> Researchware
> 
> 
> _______________________________________________
> 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