Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performance: throttle titlebar screen updates during loading #622

Merged
merged 1 commit into from
Jun 28, 2017

Conversation

rolandwalker
Copy link
Contributor

Instead of updating the UI at maximum granularity:

  • blame view progress: update titlebar stats every 5 percent
  • line-oriented views: update titlebar stats every 100 lines

This little optimization turns out to give a fair gain. In a very large repo on SSD, the main view completes 0.4 sec faster for me (8% speedup). Across many small repos I find the gains are always measurable, though almost always less than 0.1 sec. These values will vary by platform, repo and particularly by terminal emulator.

Even though we are still calling wprintw() repeatedly, ncurses is able to notice when the screen contents do not change, and optimize away unneeded writes.

* blame: every 5 percent
* line-oriented: every 100 lines
@rolandwalker rolandwalker force-pushed the perf-throttle-load-updates branch from 0e074e1 to 3eab805 Compare June 28, 2017 00:45
@@ -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,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jonas jonas merged commit 34c9313 into jonas:master Jun 28, 2017
@jonas
Copy link
Owner

jonas commented Jun 28, 2017

Heh, reminds me of the tweet about npm set progress=false considerably speeding up npm install. :)

@rolandwalker rolandwalker deleted the perf-throttle-load-updates branch June 28, 2017 02:17
@jonas jonas modified the milestone: tig-2.3 Jul 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants