[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Flood Fill



Yes, numeric is being replaced with scipy so there is no telling
how long it will be maintained.
The more dependencys you have, the less platform independent
your code gets. And since platform independence is why I am
using pygame that is important.

The speed improvements comes mostly from turning the while loops
into single line and removing the def calls. Replacing the shape
readings with pre read local variables did a bit too. Also only checking
the max values once the while loop was finished did quite a bit too.

Potentially it may be possible to blit parts, or what ever the equivalent
for surfarrays is. Doing things pixel by pixel is quite costly.

Another thing that may be fun is to introduce a colour tolerance value so
you can get a spillover even if there isn't a complete match.

If you use psyco you will see another 20% speed increase, but then
again platform independance is a problem.

Talking about numeric, are there any plans to replace it with scipy ?

Bo)

andrew baker wrote:

I believe he did that to remove the dependency on Numeric, innit?

On 11/29/05, *Knapp* <magick.crow@xxxxxxxxx <mailto:magick.crow@xxxxxxxxx> > wrote:

    Very nice!! :-)
    First number is your improvement, second is my old one.
    My question is how did you do it?
    I see that the calls were changed to inline code. But why the other
    changes? My change from surface to arrays made an improvement about
    the same as yours. IE about 2 times faster.

    0.43 #complex shape
    0.76

    0.22 #complex shape
    0.36

    0.2   #complex shape
    0.34

    2.62 #whole 1024,800*32 screen.
    4.62


On 11/29/05, Knapp < magick.crow@xxxxxxxxx <mailto:magick.crow@xxxxxxxxx>> wrote: > Sorry I see it. You nested the sub def and it wrapped the top. >




--
Andrew Ulysses Baker
"failrate"