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

Fix a conhost binary size regression due to fmt #11727

Merged
1 commit merged into from Nov 10, 2021

Conversation

lhecker
Copy link
Member

@lhecker lhecker commented Nov 10, 2021

6140fd9 causes a binary size regression in conhost.
This PR fixes most if not all of the regression, by replacing FMT_STRING
with FMT_COMPILE allowing us to drop most of the formatters built
into fmt during linking (for instance floating point formatters).

Additionally std::wstring was replaced with fmt::basic_memory_buffer
in the same vein as was done for VtEngine. Stack is
cheap and this prevents any unnecessary allocations.

PR Checklist

  • I work here
  • Tests added/passed

Validation Steps Performed

  • vttest 11.2.5.3.6.7 and .8 (DECSTBM and SGR) complete successfully ✅

@lhecker lhecker requested a review from DHowett November 10, 2021 19:50
// A valid response always starts with DCS 1 $ r.
// Then the '0' parameter is to reset the SGR attributes to the defaults.
std::wstring response = L"\033P1$r0";
fmt::basic_memory_buffer<wchar_t, 64> response;
Copy link
Member

Choose a reason for hiding this comment

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

is 64 long enough?

Copy link
Member Author

@lhecker lhecker Nov 10, 2021

Choose a reason for hiding this comment

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

Yeah I was counting with each number being 2 digits and all parameters present and I got 56 chars.
For comparison: std::wstring comes equipped with a whopping 7 chars for the SSO buffer (despite being 32 bytes large).

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

nice!

@DHowett DHowett added the Needs-Second It's a PR that needs another sign-off label Nov 10, 2021
@lhecker lhecker added the AutoMerge Marked for automatic merge by the bot when requirements are met label Nov 10, 2021
@ghost
Copy link

ghost commented Nov 10, 2021

Hello @lhecker!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

Do note that I've been instructed to only help merge pull requests of this repository that have been opened for at least 8 hours, a condition that will be fulfilled in about 7 hours 39 minutes. No worries though, I will be back when the time is right! 😉

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@DHowett
Copy link
Member

DHowett commented Nov 10, 2021

@msftbot merge this in 8 minutes

@ghost
Copy link

ghost commented Nov 10, 2021

Hello @DHowett!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I won't merge this pull request until after the UTC date Wed, 10 Nov 2021 20:19:21 GMT, which is in 8 minutes

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@lhecker lhecker added Area-Quality Stability, Performance, Etc. Area-VT Virtual Terminal sequence support Product-Conhost For issues in the Console codebase labels Nov 10, 2021
@ghost ghost merged commit 305255c into main Nov 10, 2021
@ghost ghost deleted the dev/lhecker/fix-conhost-size-regression branch November 10, 2021 21:03
@ghost
Copy link

ghost commented Feb 3, 2022

🎉Windows Terminal Preview v1.13.10336.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Quality Stability, Performance, Etc. Area-VT Virtual Terminal sequence support AutoMerge Marked for automatic merge by the bot when requirements are met Needs-Second It's a PR that needs another sign-off Product-Conhost For issues in the Console codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants