Archive for December, 2009

I wanna be like you, ooh, ooh

December 23, 2009

One day, I was using the “–similarity 100” feature of the Mercurial addremove command to work out which files were really just renamed rather than newly created. It struck me that Mercurial could do this more efficiently for the “100” case (files have identical content) by using the file checksums rather than extracting the files and diffing them. I thought I’d suggest this as a “wish” in the Mercurial project’s bug tracking system.

Could the “hg addremove –similarity 100” performance be improved by noting that the checksums of the two files must be identical for 100% similarity, and so there’s no need to extract the file content and compare. It’s a special case optimisation, but “identical” is surely the main use of this feature?

Here’s how the story unfolded:

2009-11-24 14:36 – I posted my wish

2009-11-24 14:51 – Martin Geisler agreed that it would be more efficient, and pointed me to the place in the Mercurial code where I could try to implement my suggestion.

It’s my itch, so it’s fair enough to suggest that I should do the scratching. I had a look at the code, but I’ve not done much Python yet and it wasn’t very clear to me how the code was actually working right now, and what functions I would need to call on which objects to get the checksums. I thought I might as well have a go, but probably another time.

2009-11-24 15:38 – Benoit Boissinot added a suggested implementation to the issue.

Wow! That certainly saves me some work, and probably helps me get my head around the Python code as well. I’m still a bit stuck, but I asked my colleague Pat Downey how I would build a version of Mercurial with the change. Pat offered to try it out for me, so I thought I’d wait for his results and then feed them back to Benoit the next day.

2009-11-24 18:31 – Pat emails me to say that he’s tried the change and it showed a speedup in a largish example of 17 minutes reduced to 6 minutes.

2009-11-24 18:45 – Benoit adds a rework of his changes, as commits into his working version

2009-11-24 21:03 – Benoit delivers the reworked changes into the mercurial-crew repository, and asks me to try out the new version

I come into work the next morning and discover that the stuff is all done. I confess that I didn’t follow up on the second set of changes and retest, but even that failing on my part didn’t stop the ball rolling

2009-11-26 16:00 – Benoit finishes testing the change to his satisfaction and promotes the code to the main repository.

From “wish” to implemented code in 49.5 hours!

This is what “good” looks like. No, strike that – this is what “outstanding” looks like.

It’s not about fancy tools, beautifully crafted instructions or elaborate processes: it’s about having people who are skilled in what they do and passionate about the project. I’m part of the Symbian Foundation and I’m passionate about what we do: in future when people ask me what the “contribution user experience” should be, or how package owners ought to behave, I’m going to say:

Look at Mercurial. Look at guys like Martin Geisler and Benoit Boissinot.

Go and do likewise…