In my previous blog post I had a look at the default and coal templates for hgweb in order to find a fix to the hg annotate problem. Neither of those templates presented a viable solution so the next step I decided to take was to have a look at a couple of patches that people have attached to the bug, which apparently reduced the loading time by a bit.
Patch by Smaug
Smaug is currently the person assigned to the bug and he put up a patch back in 2008 that got an r+ rating from ted. However, it doesn’t do exactly what jorendorff wants. The patch displays a loading message until the entire page is done loading and then shows the code. Instead, jorendorff wants the first screenful to appear almost right away. Thus, I decided to remove the loading message and then test the loading time of annotate. I was able to get a time of ~12sec to ~14sec on my machine when loading this file.
Obviously this is an improvement in loading time (currently the loading time is ~20sec). However, I want it to be even faster. One great thing about this patch is that now you can select code without selecting the line numbers. Another important change is that the huge table is now gone, replaced by div and pre tags. There are some things here that I can definitely use. I will be using div tags in my implementation as well but I don’t know if I will be doing it the same way as Smaug.
Patch by Mats Palmgren
The next patch I examined also gets rid of the table and uses a pre tag to display the code. I tested it on my machine and got a loading time of ~7sec to ~8sec. Now, this is a definite improvement over the current loading time. The increase in speed over the current implementation is very noticeable. However, the problem with this patch is that it doesn’t use valid HTML. I want my implementation to use valid HTML so I can’t really use the same type of implementation as this patch. I’ll have to come up with a more conventional approach.
I think by now I’ve researched all the resources that I could acquire. Now, I can get down to actually writing the patch. I’m pretty sure I know what to do, lets see how it turns out. Stay tuned!