mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 02:12:17 +02:00
filter-repo: fix perf regression; avoid excessive translation
Translating "Parsed %d commits" a hundred thousand times (once per commit), turned out to be somewhat expensive -- especially since we were only going to print it out once every few thousand commits. Translate it once and cache the result, shaving off about 20% of execution time for a simple rewrite of a test repository (rails). Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
2472d1c93f
commit
3999349be4
@ -938,6 +938,9 @@ class FastExportFilter(object):
|
||||
# to subsequent commits being empty
|
||||
self._files_tweaked = set()
|
||||
|
||||
# Cache a few message translations for performance reasons
|
||||
self._parsed_message = _("Parsed %d commits")
|
||||
|
||||
# Compile some regexes and cache those
|
||||
self._mark_re = re.compile(br'mark :(\d+)\n$')
|
||||
self._parent_regexes = {}
|
||||
@ -1555,7 +1558,7 @@ class FastExportFilter(object):
|
||||
# Show progress
|
||||
self._num_commits += 1
|
||||
if not self._quiet:
|
||||
self._progress_writer.show(_("Parsed %d commits") % self._num_commits)
|
||||
self._progress_writer.show(self._parsed_message % self._num_commits)
|
||||
|
||||
def _parse_tag(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user