From: Mark B. <mb...@0x...> - 2000-06-03 19:34:26
|
On Sat, 03 Jun 2000, Peter Nicolai wrote: > So there is also the slice operator, but that turns > out even slower: No, it's not slower. It's slower for plotting a single pixel, but that's to be expected. For many things, it's about 4x faster. I'll put together a small benchmark of various styles, and you'll all be able to see for yourself. > >Why Numerical Python? > >If x and y are Numerical Python arrays, then the > >speed of the operation x + y is close to the speed of > >doing it in C if the arrays are big enough. Thus, > >Python can be extended with a full scientific array > >language with sophisticated indexing and shaping > >operations and yet be closer to the speed of a > >compiled language than to the speed of Python itself. I've not used "Numerical Python", but here's a few things to consider: The manipulation of multidimensional chunks of surfaces is already handled by blitting. Numerical Python may offer something other than array operations, but if that's all it does, it's not going to help per-pixel manipulation. The rest of Python's math is abysmally slow. This is the price of implementing integers as objects, and requiring several function calls and conditionals for each operation. > This is deep water for me but it seems like Pete > Shinners' idea of numpy-arrays that could be treated > as 'fake' software surfaces that could then use the > blit operation would be a decent solution to these > kinds of problems, if it can be done. The > execute-buffer thing sounds like it would be better & > faster but also a lot more work to implement, though I > have no idea if this is true. Also I think it's really > important to keep things simple because that's the > whole reason to use Python instead of C anyway. A command buffer for operations will most likely be a bit of work. It'd probably be a bit awkward in comparison to what people are generally used to as well, in order to make it efficient. Before that, though, I think I'll work on some drawing primitives for the existing surfaces. Circles, lines, etc. We'll see. |