There’s probably some difference in speed when doing local versus global variable lookups. (Assuming the same number of items as before, of course.)
However, it’s not the raw speed that’s significant here; it’s the algorithmic efficiency. Using ‘item i of theList’ has O(n) efficiency (where n = number of items in list) whereas ‘item i of theList of kludgyScriptObj’ has O(1) efficiency. In the first case the speed depends on the number of items in the list (i.e. the bigger the list, the longer the lookup takes) whereas in the second case the lookup time is constant (i.e. always the same).
That it should ever be O(n) in the first place is just down to shoddy implementation - apparently there’s some extra code that checks for circular references or something, and it’s this that causes the O(n) behaviour. Plenty other languages manage to be robust without sacrificing performance, btw. However, using references to refer to the list routes around this extra code, apparently, giving you the performance you’d expect - albeit making AS easier to crash if you’re not careful.[1]
HTH
has
[1] p.s. Did I mention that these days I prefer Python already? Whatever the inanities of Python, Ruby et-al - heck, even Perl(!) - they’re still a relative breath of fresh air after AS’s special kinds of madness [2].
[2] (Yes, I am feeling particularly peeved at AppleScript tonight… why do you ask?;p)