Consider the following very simple script:
property theData : {} set theFile to (choose file with prompt "Choose tab-delimited file:")
set theParas to paragraphs of (read theFile as text) repeat with aRow in theParas set end of my theData to {contents of aRow} -- using 'my' is absolutely vital for large files!! end repeat
If run with a text file of 10 000 lines, it takes about 12.5 seconds on a MacBook Pro 2.2 GHz Core 2 duo, 4 GB, SSD 200 GB. If you remove the 'my', it won't terminate! Nasty!
(Ok, I didn't wait for hours, but for minutes.)
The file is a very simple text file with all rows equal, being: "AP name 0 0 A longish comment about it all" with tabs on each side of the '0', so there are 4 columns, a total of 42 characters per line.
Originally, the script took the text items of this (with tab as separator) but I discovered that the bug was just as bad without picking text items; all it takes is making a list of lists. The reading of the file into paragraphs only takes about 0.15 seconds, so all time is spent in the repeat loop.
If run on a 1000-line file, it works better: it will terminate less than 0.2 seconds with the 'my', and about 0.7 seconds without the 'my'.
So, despite no handler or script object is involved, the 'my' is needed, and it is also needed if you wrap it into a handler.
______heb____________________________
|