Inefficient code

Bert Shuler bertshuler at YAHOO.COM
Sat Jun 27 15:08:46 EDT 2009


I have written this code a few different ways. Each seems to be  
equally inefficient. I am attempting to compare to images, pixel by  
pixel, and record the differences.

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

It takes many minutes to process a 200x200 image. I want this code to  
eventually compare full screen-captures, so if there is any way to  
speed it up, I am open for advice.

Thanks

Bert


More information about the use-livecode mailing list