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

tabbar: Don't recreate the tabbar every time #1043

Merged
merged 1 commit into from Oct 15, 2020

Conversation

k-takata
Copy link
Contributor

The height calculation in win_toggle_tabbar() was wrong. So, when the
function was called, the tabbar was recreated every time.

Because of this, changing the title sometimes took very long time.
(With the default installation of Cygwin, the current directory is shown
as the title. Thus, on my slow machine, executing a cd command
sometimes took more than one second.)

Fix the height calculation and remove an unused variable.

The height calculation in win_toggle_tabbar() was wrong. So, when the
function was called, the tabbar was recreated every time.

Because of this, changing the title sometimes took very long time.
(With the default installation of Cygwin, the current directory is shown
as the title. Thus, on my slow machine, executing a `cd` command
sometimes took more than one second.)

Fix the height calculation and remove an unused variable.
@mintty
Copy link
Owner

mintty commented Oct 15, 2020

While this patch cleans up height calculation a bit, I don't see how the previous calculation was wrong.
And particularly I do not see how this could change the creation of the tabbar, and affect speed.

@k-takata
Copy link
Contributor Author

Before this change:

height = cell_height + margin * 2;
TABBAR_HEIGHT = height + padding * 2 = cell_height + margin * 2 + padding * 2

So, height and TABBAR_HEIGHT can never be the same value.
Therefore, the following if-block is always executed when win_toggle_tabbar() is called.

mintty/src/wintab.c

Lines 289 to 291 in 4022d5b

if (height != TABBAR_HEIGHT && initialized) {
tabbar_destroy();
}

This means that the tabbar window is always recreated when win_toggle_tabbar() is called.
On a slow machine, recreating the tabbar takes long time.

@mintty mintty merged commit 04e380c into mintty:master Oct 15, 2020
@k-takata k-takata deleted the tabbar-performance branch October 15, 2020 13:12
mintty added a commit that referenced this pull request Oct 15, 2020
@mintty
Copy link
Owner

mintty commented Oct 24, 2020

Released 3.4.1.

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.

None yet

2 participants