Most Efficient Script question
Posted: Wed Jan 12, 2011 5:53 pm
Here's the situation. I have a tab delimited text file that is 70,000 lines long - about 37 MB in size. Here's what I need my script to do:
1. Go through each line and read two items (first name and last name)
2. Create a new user name based on first name, last name, and a random number
3. Add a tab character and the new name at the end of each line
I've tried to different ways to loop through the file - when I do a regular repeat loop like the following, it takes a decade to run:
repeat with i = 1 to the number of lines of myVariable -- which contains the text file
do the code
end repeat
And I tried this type of loop, but it crashes LiveCode:
repeat for each line i of myVariable
do the code
end repeat
What is the best way to do this, where it won't take a decade to run and won't crash LiveCode? Any help greatly appreciated.
1. Go through each line and read two items (first name and last name)
2. Create a new user name based on first name, last name, and a random number
3. Add a tab character and the new name at the end of each line
I've tried to different ways to loop through the file - when I do a regular repeat loop like the following, it takes a decade to run:
repeat with i = 1 to the number of lines of myVariable -- which contains the text file
do the code
end repeat
And I tried this type of loop, but it crashes LiveCode:
repeat for each line i of myVariable
do the code
end repeat
What is the best way to do this, where it won't take a decade to run and won't crash LiveCode? Any help greatly appreciated.