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

Re: [pygame] speculation: a JIT for Pygame



A great idea. By way of analogy, when the Massachusetts Institute of Technology opened 150 years ago, it was possible to get a degree in sewage engineering, because people were still figuring out how to make sewers. 

I am all for any change which makes the "plumbing" of bitmap graphics more automated, because if Python "does the right thing" automatically, newbies can write games instead of blitters. These days, it's almost at the point where you don't want to be too clever, for fear that you end up slowing down your graphics hardware.

Hope this doesn't offend.


On Jan 23, 2011, at 12:14 PM, Lenard Lindstrom wrote:
> Unlike other image packages, Pygame supports operations on many different pixel formats: 32 bit pixel with alpha can blit to 24 bit without alpha, eight bit palette can blit to 16 bit without alpha, and so on. This makes it cumbersome to add new blit operations, like exclusive-or, and even more difficult to add a new pixel format.
> 
> The proposal:
> 
> With the acceptance of PEP 3146 the Unladen Swallow offshoot of CPython will be merged back into trunk Python sometime around Python 3.3. Unladen Swallow brings with it a Python JIT powered by LLVM. LLVM is a compiler tool kit that also provides runtime compilation to machine code. So the idea is to generate blitters on demand for various pixel configurations with LLVM.
> 
> Alternatives:
> 
> Another possibility is to design as generic a blitter loop as possible, then include some specialized loops for common pixel formats. Or one could develop a preprocessor that translates a specialized blit description language into corresponding C code, much the way Pyrex transforms Python like code into C. This approach is used to write sound modules for the Lisp based sound processing language Nyquist.
> 
> 
> This is all just far out speculation. It is a long term goal not intended for the next Pygame release.
> 
> Lenard Lindstrom
>