Inefficient code

Richard Gaskin ambassador at fourthworld.com
Fri Jun 26 18:07:16 EDT 2009


Bert Shuler wrote:

> ON mouseUp pMouseBtnNo
>      put 0 into c
>      set the startvalue of scrollbar Progress to 0
>      set the endvalue of scrollbar Progress to the length of imagedata  
> of image "Alpha"
>      put the imagedata of image "Alpha" into idataalpha
>      put the imagedata of image "Beta" into idatabeta
>      REPEAT FOR each char myChar in idataalpha
>          set the thumbposition of scrollbar Progress to c
>          IF myChar is not  char (c) of idatabeta THEN
>              put c && char (c) of idatabeta & return after hAll
>          END IF
>          put c+1 into c
>      END repeat
>      put hAll into field "diff"
> END mouseUp

Ditto what the others have said about the progress bar. Those updates 
prompt so many layers of OS rendering code that they take quite a toll. 
  I went to a mod solution with one of my projects and it gave me an 
order of magnitude speed boost.

But I have a question about the algorithm's logic:  if c is initialized 
to 0 but the data in idatalpha is traversed starting with the first 
character, wouldn't the comparison always be one character off?

--
  Richard Gaskin
  Fourth World
  Revolution training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com



More information about the use-livecode mailing list