"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.

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to