Jane Austen's peculiarity

Richmond richmondmathewson at gmail.com
Sun Aug 9 21:57:41 CEST 2015


"Just" by loading the textFields into variables the whole script runs 
considerably faster:

on mouseUp
    put empty into fld "COOKED"
    put the long time into fld "STARTT"
    put 1 into KTEKST
    put 1 into KCOOK
    put fld "TEKST" into TEKST  --!!!!
    put fld "WERBS" into WERBS --!!!!
    repeat until line KTEKST of TEKST contains "finalSolution666"
       put line KTEKST of TEKST into LTEKST
       put 1 into KWERBS
       repeat until line KWERBS of WERBS contains "finalSolution666"
          put "was " & line KWERBS of WERBS into FRAZE
          put "were " & line KWERBS of WERBS into FRAZE2
          if LTEKST contains FRAZE then
             put KTEKST & " : " & LTEKST into line KCOOK of fld "COOKED"
             add 1 to KCOOK
          end if
           if LTEKST contains FRAZE2 then
             put KTEKST & " : " & LTEKST into line KCOOK of fld "COOKED"
             add 1 to KCOOK
             end if
          add 1 to KWERBS
       end repeat
       add 1 to KTEKST
    end repeat
    put the long time into fld "STOPT"
end mouseUp

"--!!!!" indicates the important changes.

The new script (with loading textFields into variables) with one text 
took 115 seconds.

The same text with the old text (no loading) took 10 minutes and 7 seconds.

5.27 times faster . . . Wow!

I am surprised at such a speed difference!

Richmond.



More information about the use-livecode mailing list