Inefficient code

Mark Wieder mwieder at ahsoftware.net
Fri Jun 26 16:22:10 EDT 2009


Bert-

Friday, June 26, 2009, 12:50:50 PM, you wrote:

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

Obvious statement #1: this will run *much* faster if you don't update
the scrollbar (comment out that line and you'll see what I mean)...

OK - so how to deal with this and still show progress? Do you really
need to update the scrollbar for *every* byte in the imagedata? A
200x200 image has 40,000 pixels - that's 40,000 scrollbar updates. How
about something like

  put c+1 into c
  if c mod 100 = 0 then
    set the thumbposition...
  end if

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list