Skip to content

Commit

Permalink
perf: throttle screen updates during load
Browse files Browse the repository at this point in the history
* blame: every 5 percent
* line-oriented: every 100 lines
  • Loading branch information
rolandwalker committed Jun 28, 2017
1 parent 6dce59b commit 3eab805
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ blame_read(struct view *view, struct buffer *buf, bool force_stop)
if (!state->commit) {
state->commit = read_blame_commit(view, buf->data, state);
string_format(view->ref, "%s %2zd%%", view->vid,
view->lines ? state->blamed * 100 / view->lines : 0);
view->lines ? 5 * (size_t) (state->blamed * 20 / view->lines) : 0);

} else if (parse_blame_info(state->commit, state->author, buf->data)) {
bool update_view_columns = true;
Expand Down
5 changes: 4 additions & 1 deletion src/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,10 @@ update_view_title(struct view *view)
wprintw(window, " - %s %d of %zd",
view->ops->type,
line->lineno,
view->lines - view->custom_lines);
MAX(line->lineno,
view->pipe
? 100 * (size_t) ((view->lines - view->custom_lines) / 100)
: view->lines - view->custom_lines));
}

if (view->pipe) {
Expand Down

0 comments on commit 3eab805

Please sign in to comment.