Performance Problem with large file
Richard Gaskin
ambassador at fourthworld.com
Sat Feb 24 20:32:07 EST 2007
Len Morgan wrote:
> Here's the "Convert" mouseUp script:
>
> ########################################################
>
> # Clear the output field we're going to use and turn if off
> # (for performance reasons)
> put empty into field "xmlOutput"
> put xmlFileHeader() after field "xmlOutput"
> set the visible of field "xmlOutput" to false
>
> REPEAT for each line curLine in field "txtInput"
> put the item 1 of curLine into idnum
> put item 2 of curLine into lst_n
> put item 3 of curLine into fst_n
> put item 4 of curLine into day_in
> get xmlWriteNewInmateRecord(idnum, lst_n, fst_n, day_in, tCount)
> get setPercentDone(tCount, ttlLines)
> put "Record " & tCount & " of " & ttlLines into field "progressText"
> put tCount + 1 into tCount
> END REPEAT
>
> # Write the closing tag
> put "</RCATS>" & cr after field "xmlOutput"
> set the visible of field "xmlOutput" to true
>
> #######################################################
>
> That's the "meat" of the handler. Hopefully most of it will
> be self-explanitory. The only part that might not be obvious
> is the setPercentDone function which is given a record number
> and total records and update a progress bar. Hope that sheds
> some light.
Mark and Jim made some excellent recommendations on most of it, but the
progress bar is something that catches my attention. In one of my
products I found that the progress bar update was eating so many clock
cycles for the OS to draw its pretty rendering that cutting the
progresss down to 1/10 cut overall processing time for the handler as a
whole in half.
Hard to say if that's a factor here, but you could try changing this:
get setPercentDone(tCount, ttlLines)
put "Record " & tCount & " of " & ttlLines into field "progressText"
...to this:
if tCount mod 10 = 0 then
get setPercentDone(tCount, ttlLines)
put "Record " & tCount & " of " & ttlLines into field "progressText"
end if
...and see what happens. With a lot of records you may never see the
changes in between every tenth record anyway.
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list