data status: optimize printing status list

`--untracked-files` and `--unchanged` coupled with `--granular`
puts a lot of stress on `show_status`. Currently, with those options,
dvc spends ~26s on `_show_status` function.

Unhappy with the above result, I looked into improving the situation with
`console.out`. It did reduce that to 9s but it still felt like a lot.

Then I dropped to good old colorama, which dropped to 3s(term)/1.24(redirected).
I tested with buffering output which dropped this further to
~600ms(term)/~100ms(redirected).

This may seem like premature optimization, but this was preventing me
from figuring out perf issues in granular outputs, and I believe the
user should not be penalize for using feature that we already offer.
This commit is contained in:
Saugat Pachhai (सौगात)
2022-07-25 17:47:23 +05:45
committed by skshetry
parent fd7dcae8aa
commit 896acedb07
2 changed files with 9 additions and 5 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ from dvc.cli import main, parse_args
from dvc.commands.data import CmdDataStatus
from dvc.repo import Repo
from dvc.repo.data import Status
from tests.func.parsing.test_errors import escape_ansi
@pytest.fixture
@@ -135,5 +136,5 @@ DVC unchanged files:
expected_out += """\
(there are other changes not tracked by dvc, use "git status" to see)
"""
assert out == expected_out
assert escape_ansi(out) == expected_out
assert not err