-
Notifications
You must be signed in to change notification settings - Fork 235
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
Increase foldability of various templates #1338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity, switching One area of interest is in |
It looks like I can get another 8kb by regularizing the tail of It also looks like the cluster around |
/azp run |
No pipelines are associated with this pull request. |
Overall looks like goodness. Just a few comments. |
For windows-rs I managed to write a "constexpr" version of |
Making the constructor of |
I was referring to return values, which has a lot more optimizing value. |
…/cppwinrt into user/jonwis/template-fold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
#1338 changed the NuGet version to a property, but didn't update the build.yml to do the same thing
#1338 changed the NuGet version to a property, but didn't update the build.yml to do the same thing
SizeBench revealed heavily non-foldability of certain C++/WinRT templates contributing to increased Windows binary sizes. Some small tweaks dropped the size of
test.exe
(release, x64) by ~132kb. (5180416 -> 5030400, or 2.8% ... which isn't a super lot, but it's nonzero.Fixes #1334 and related
Changes
Enable nuspec iteration - Bump the default nuspec version to 3.0.0.0 so
build_nuget.cmd
and iterating with a local nuget source is easier.Add solution files - Niceness for people who live in Visual Studio.
Fold delegate bases - Forced the layout of the delegate types to be regular by moving the reference count into a base before the non-ABI types. This folds nearly all the AddRef/QueryInterface instances into one. Releases are still unique because they call up into dtors.
Fold "report" in invoke - The invoke helper is a try/catch{report} but the body of "report" is identical on each invoke specialization. Move it to a unique non-inlineable method.
Fold event::add - Make the delegate first, then all the "expand the collection" instances are identical.
Further Work
SizeBench reports the following additional foldability wastage, quoted from the same test.exe:
::Invoke
vtable and offset adjusters.make_agile_delegate
hstring
construction.Testing
Tested by
build_and_test.cmd
- all built, all passed