Skip to content

Instantly share code, notes, and snippets.

@pllim
Last active July 9, 2020 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pllim/c059dbdb696c2f49d7623ea07a55fcd8 to your computer and use it in GitHub Desktop.
Save pllim/c059dbdb696c2f49d7623ea07a55fcd8 to your computer and use it in GitHub Desktop.
Bisecting astropy for Issue 10548

Brian Hayden found performance issue that was reported at astropy/astropy#10548 . Will git bisect identify the offending commit? Reportedly, it was not an issue in 3.2.x but an issue in 4.0.x.

Test script (runme.py) can be something like this and will be in the root directory of the repository checkout:

import time as _time
import numpy as np
from astropy import table


def main():
    time = list(np.random.randint(0, 1000000, 100000))
    rate = list(np.random.randint(0, 1000000, 100000))
    error = list(np.random.randint(0, 1000000, 100000))
    t1 = _time.time()
    table.Table([time, rate, error], names=["time", "rate", "error"])
    t2 = _time.time()
    tt = t2 - t1
    if tt > 0.7:
        raise ValueError(f'too slow t={tt}s')


if __name__ == '__main__':
    main()
  1. Do a fresh clone of astropy repository.
  2. Checkout its 4.0.x branch.
  3. Find the commit hash that is right after the last 3.2.x release.
  4. git submodule init
  5. git submodule update
  6. git bisect bad
  7. git bisect good 85ae15f5bf09be33eff49d2630ba41df9ef5a840
  8. git bisect run python ./runme.py

Let it run and it will report something like a4ef5f6fdb4c9008b1e6a509bf10f77f2f13cde2 is the first bad commit. In this case, the reported bad commit might not be accurate. One needs to adjust runme.py for a proper test case.

When the culprit in found, git bisect log can be informational and finally git bisect reset to end the session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment