Re: sloooooww

new topic     » goto parent     » topic index » view thread      » older message » newer message

Optimization, my friend, optimization!

> procedure write_buff()
>    for y = ymin to ymax-2 do
>       poke(a+320*y+xmin,buff[y-ymin+1])
>    end for
> end procedure

How about adding 320 instead of multiplying by it? i.e.

        poke(a+q+xmin, ...)
        q = q + 320

This would be much, much faster. And since write_buff() gets called a lot ...
Also see about stuffing some of your calculations in a lookup table, or
at least sticking predictable values in a table to reduce the amount of
multiplications you have to do. Mults and divs kill execution time.

--
Cameron Kaiser
http://www.sserv.com/
spectre at sserv.com
--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu