Thoughts on Kid

In the last few months I have spent a lot of time patching and extending Kid. During this time I have had to field lots of questions and complaints thrown at me. The two things that seem to appear the most are concerns about Kid's speed and it's lack of good error messaging. I have given a lot of thought to the speed problems in the last few weeks and at PyCon 2006 I had the opportunity, along with Mike Pirnat, to start working on it. We decided to focus on the speed issue, because that seems to be the thing that turns most people away. Kevin Dangoor also brought up the fact that changes to Kid's internals may change the solution for the error reporting anyway. I created a new branch where we could break stuff and not anger any users. Although there is still lots of work two do there were two big wins:
  1. Another developer understands some of Kid's internals (which is not entirely easy!)
  2. Scripts and tests to help in determine the effect of changes
I have some other more interesting changes in my working copy of the pycon-sprint-2006 branch. After looking at the number of function calls and nested generators it is a pretty good assumption that this can be made faster. I am experimenting with unstreaming parts of Kid. Now since a rewrite Kid's internals would take a long time and the changes may not help, I wanted to identify things that can be done quickly. The first step is to eliminate the use of TEXT in the streaming process. Instead I am attaching the text nodes to the text and tail attributes of elements. This is essentially what ElementTree does. Ideally this will lower the number of times that data will need to go through all of the generators thus speeding up the template. I am planning on committing code more frequently that I am doing right now. This means that there will be times when the branch is broken. So use it at your own risk!
blog comments powered by Disqus