Try changing it to a local variable. This has made several of my loop faster.
Rich...
~5000 lines of text
When i tried a similar loop with far less data I was getting memory errors but setting the array to a local variable fixed it and it run much faster.
Sorry, perhaps I'm having a stupid moment, but how do you mean?
That said, the reason I'm trying to write to a file is because I'm trying to remove an array with all the elements in. So before I clear the array, I'm attempting to write the contents to a file and save resources later by scanning the file rather than the huge directory.
>
> For %LWRWALLTMP Items %WALLS()
> ->Write File File; File %LWRLSTLOC; Text %LWRWALLTMP; Append On;
> End For
>
> But it's incredibly slow.
>
>
I think just changing %LWRWALLTMP to %lwrwalltmp will help a lot and then if you do a
variable set %walls to %WALLS(:)
Variable split %walls with a , splitter
Then use %walls in the loop
This is what i did and it worked but as I said it was far less data..
Hope this helps... Rich
If you can get this loop into the same task that creates the variable %WALLS and use all local variables that would be the ideal..
One more suggestion ....
I have found that even with local variables any loop function on a large array is slow. The next step would be to use a JavaScriptlet. This would be faster but perhaps still to slow.
The variable split, section,set and even search and replace are very fast and after re-reading your post I think you want to archive the data but I am not sure what you mean by scan the file later.
I do not have much experience with large amounts of data and files however I would try to save the data from a comma separated variable ( or other separator) then retrieve it in the same manner and just split it again. This should be very fast...
Rich...
OK..... I have missed the most obvious of all ( I think) I was a little distracted before.. (that's what I get for trying to sneak in a little tasker time during FAMILY time.... ) :( I always seem to forget about the all powerful variable JOIN...
This is untested but i believe if you just do a
Variable join of %WALLS
with a carriage return as the joiner ( I think this is possible but you might need to search the forum on how get a carriage return as a joiner) this should save to the file and give it the readability I think you are looking for.
OK that's the last one, promise .... :)