Hello EM,
Sorry for the long delay.
The Applescript Language Guide PDF defines the “a reference to” operator on pages 203, 204 and 205. Here’s a link: http://developer.apple.com/documentation/applescript/conceptual/applescriptlangguide/AppleScriptLanguageGuide.pdf It says it has several uses, one of which is the one I mentioned about accessing items in a list efficiently. It also gives example scripts that you can run to see for yourself. I can assure you it does work, although loading the whole script as a script object, as Adam Bell suggested, may provide the same speed gain. (I will try it when I have time, to see how it compares).
However, since you did NOT see any difference in speed, I wonder if your delay might be coming from somewhere else in your script. As with most complex problems, I think your best approach would be to “divide and conquer.” Since you suspect the list-checking part of the script, why not make a copy of your script and then delete or comment out all but the list checking. Also, I couldn’t tell where the file name strings you were checking were coming from. If they are coming from another list, bear in mind that you might want to use the “a reference to” operator for both lists. Can you load the entire list of 24000 file name strings into a list and then check your other list of name strings without doing any logging, data checking or other work? If so, and it turns out to run without bogging, work outward from there.
Here are some wild guesses:
How are you building your lists? I’m pretty sure that 24,000 cycles of:
set my_list to my_list and this_string
will take a lot longer than:
copy this_string to the end of my_list
and it should be even faster with:
copy this_string to the end of my_list_ref (where my_list_ref is a reference to my_list)
How about the data checking? Could your script be comparing the data to every item in the list? Can you remove the data checking then then run the script to see how it compares?
How about timing every piece of work so you can really see where the slowdown occurs?
Well, I’m sure you know all this. My guess is that you were hoping someone could spot the problem without you having to slog through a major rebuild. Sometimes the hard way is the only way. Be encouraged, I’m sure you can get it.
Wishing you complete success,
icta