Bisecting History

posted 10 Dec 2009

On your marks…

Some people noticed that somewhere between two versions, performance of Xtend has degraded. To me (wanting to help), this seemed like a perfect opportunity to use git bisect together with the Eclipse git mirrors. I’m going to describe how this helped to quickly find the needle in the revision haystack.

…Ready…

Clones of the necessary Eclipse Git repositories already existed on my disk as I ran

git clone git://dev.eclipse.org/org.eclipse.emf/org.eclipse.emf.git
git clone git://dev.eclipse.org/org.eclipse.m2t/org.eclipse.m2t.git

a few days ago.

…Set…

All I needed was an indicator to test whether a certain revision was good (i.e. running as fast as in 0.7.2) or bad (i.e. running significantly slower). A demo workflow from the emfmodelvisualizer project completed in about 1.5 seconds with 0.7.2, but took 3 seconds with the current development version.

…Go!

This was good enough for me, so I started bisecting:

git bisect start Galileo_SR2 HEAD -- org.eclipse.xpand/plugins/

This tells git to start a bisection process, with Galileo_SR2 being the last known good revision and HEAD being a bad one. As I suspected some changes in Xtend/Xpand to be responsible, I limited the scope to org.eclipse.xpand/plugins/, so git bisect would only test commits which changed files in that area.

Bisecting: 27 revisions left to test after this (roughly 5 steps)

From this point on, git guided me through a binary search for the commit which introduced the problem. All I had to do was to tell git whether the current revision was good

git bisect good

or bad

git bisect bad

After about 4 minutes of “Eclipse refresh, run workflow, git bisect good/bad” cycles git pointed me to the commit that caused the trouble, finally leading to Bug 297053 .

Of course you can do this manually with any other SCM system, but git’s guidance and fast local switching between revisions made it an easy thing to do. It would have been even more comfortable if the decision about a revision’s goodness was automated. In this case, git would be able to do this all alone, allowing me to lean back and enjoy a cup of coffee in the meantime. Check out the git bisect documentation for more details.

I’m really looking forward to full git support on Eclipse.org.