Inefficient code

Mark Smith lists at futilism.com
Fri Jun 26 17:37:07 CDT 2009


On 26 Jun 2009, at 23:07, Richard Gaskin wrote:
>>
>
> 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?
>
> --
>

I think you're right - the first comparison would be char 1 of  
idataalpha to char 0 (non-existent) f idatabeta, then 2  to 1 etc.

And for any benchmark junkies out there, "add 1 to c" is nearly twice  
as fast as "put c + 1 into c" on my machine, though it would only  
make a small difference even with hundreds of thousands of iterations  
(maybe in this case with large images).

Best,

Mark



More information about the use-livecode mailing list