Saturday, February 25, 2006

Exquisite Timing

I got up early this morning to write my slides for the bytecode talk. I didn't get down to the conference this morning until Guido's keynote was well underway. When I walked into the ballroom, the slide about the AST code was on the projector and Guido was saying something about the speed of the new compiler. The very next moment Guido asked me whether it was faster -- as if it were scripted.

The compiler actually is faster, but not by much. We made no effort to make the compiler faster. I just wanted the code to be simple and easy to maintain. There are some obvious optimizations available. Changing the ast to use a real arena implementation should speed up memory allocation. Doing peephole optimizations before the assembler runs should speed it up. Maybe using the arena for the parser would help, too. Changing pgen to generate the AST directly and avoid the hand-coded transformations in ast.c should be a win, but won't get done for Python 2.5.

No comments: