BF+ENH+OPT: @memoize, correct config target for logging outputs #4194
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ Coverage Diff @@ ## maint #4194 +/- ## ======================================== Coverage ? 89.26% ======================================== Files ? 275 Lines ? 36791 Branches ? 0 ======================================== Hits ? 32841 Misses ? 3950 Partials ? 0
I've switched this to use
ConfigManager.__init__() and external_versions._get_git_version() instantiate GitRunner() and pass it as an argument to config.get_git_version(). This is fine, but not really necessary. There's nothing distinct across these instances. (The current working directory can change, but that doesn't matter for 'git version'.) The next commit will wrap get_git_version() with lru_cache(). Continuing to pass separate GitRunner instances would prevent the cache from being effective because _every_ ConfigManager() instance passes a unique runner. Make the runner argument optional, and update ConfigManager.__init__() and external_versions._get_git_version() to not use it. Note that reason we need to keep the argument around at all is because external_versions._get_system_git_version() relies on passing it a plain Runner() instance.
I saw us invoking git version over and over again. There really should be no reason to sample that "densly" and IMHO it should be safe to assume that it would not drastically change through the life time of the process. Moreover, we are using it seems only to check if git >= 2.8, which is from 2016 . I think it is most sensible to assume that we would have more recent one, especially given that we need git annex >= 201905 ATM Modified-by: Kyle Meyer <firstname.lastname@example.org> Switched from custom decorator to lru_cache.
My update of this branch to use