How can we dynamically create variable names from changing value "x" on a loop?

Richard Gaskin ambassador at
Mon Nov 7 13:05:00 EST 2016

Ben Rubinstein wrote:

 > On 07/11/2016 16:52, Richard Gaskin wrote:
 >> On the one hand, each array access requires a small amount of
 >> overhead to run the key through a hash to find the value's address.
 >>  However, that overhead is pretty small...
 > No, no - the meat here is this:
 >>     do makeAccessVars("vi", line 1 of tTSVdata)
 >>     ...
 >>     repeat for each line tRec in tTSVdata
 > vs
 >>     repeat for each line tRec in tTSVdata
 >>         put explodeRow(tRec, tColumnNames) into aData

Ah, thanks.

Without seeing the code for explodeRow it's not possible for me to have 
an informed assessment of its impact.

 > I wouldn't care to hazard a guess as to the relative speed of
 > "aData[x]"  versus "item x": but it's the overhead of the function
 > which creates the array on that I don't want to pay *on every row*.

The function call itself has very small overheard.  Whether the 
definition of that function takes more time than walking through the 
characters for the chunk expression can't be known without testing.

  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  Ambassador at      

More information about the Use-livecode mailing list