script puzzle
Phil Davis
phildavis at attbi.com
Tue Feb 19 00:03:01 EST 2002
OK, first my disclaimer: I'm making this all up as I go.
I'm thinkin' the problem is likely this:
The "line tNum of temp1" phrase forces MC to examine each char in the container, starting at the start, and keep a tally of the line delimiters it finds, until the tally = the target line number. The code asks MC to do this at least once per iteration, and probably 7x (it's used in 7 statements inside the loop). It takes more time to do as the target line number grows greater, because there is a greater number of line delimiters (returns) that have to be found than when it was looking for a lower line number.
If this is the problem, Mr. Yennie's approach (or any similar one) should take care of it. It eliminates line-delimiter counting entirely.
Of course, I could be wrong. ;o)
Phil Davis
----- Original Message -----
From: "andu" <undo at cloud9.net>
To: <metacard at lists.runrev.com>
Sent: Monday, February 18, 2002 2:29 PM
Subject: script puzzle
> This script reads a 5700 line file, each line with 15 "|" delimited
> chunks, replaces some items with new values and dumps the result into a
> new file. It starts fast but towards the end does less 2 lines per
> second. Can't figure out what slows it down.
> (Linux, Athlon 750MHz, 128Mb RAM).
> Anyone has a clue? This is done as a command line script, no UI.
>
> on startup
> put url ("file:./file.txt") into temp
> set the itemdel to "|"
> put 0 into tNum
> repeat for each line i in temp
> add 1 to tNum
> --put tNum
> put cr & i after temp1
> put "-" into first item of line tNum of temp1
> put "-un-" into item 2 of line tNum of temp1
> put 0 into last item of line tNum of temp1
> put 0 into item -2 of line tNum of temp1
> put 0 into item -3 of line tNum of temp1
> put 0 into item -4 of line tNum of temp1
> put 0 into item -5 of line tNum of temp1
> end repeat
> put temp1 into url ("file:./file2.txt")
> end startup
> --
> ____________________
> Regards, Andu Novac
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
More information about the metacard
mailing list