IDSIA/sacred

Repeated repo.is_dirty Call Slows Initialization

Markus28 opened this issue · 1 comments

Hey,

I am using sacred in a project. Initializing runs has become very slow: it currently takes 1-2 minutes. During initialization, every relevant source file is added via Ingredient.add_source_file. I profiled my initialization procedure and noticed that about 70% of the time is spent on ca. 150 repo.is_dirty() calls in

def get_commit_if_possible(filename, save_git_info):

I was wondering whether anybody else was facing a similar issue. Maybe it would be a good idea to cache the result of repo.is_dirty() (though calling repo = Repo(directory, search_parent_directories=True) may still be necessary in order to handle nested repositories (?)). This is not a pressing issue, but if anybody else is experiencing something like this, it might be worth looking into. Thanks for your support!

Best,
Markus

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.