-
Notifications
You must be signed in to change notification settings - Fork 402
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
Trimming Support #3767
Comments
Worth noting that trimming is configurable; you can explicitly include symbols you know will be used. I have some notes re: reflection, publishing/packaging, and Wasm. |
So this means it cannot be enabled AT ALL until we move away from winforms, right? |
I assume trimming can be controlled on a per project basis here? I assume regardless however we can't go enable AOT until the entirety of BizHawk is trimmable. |
Yeah I don't think trimming is gonna happen any time soon. Reflection is just one example of many patterns that are not compatible with trimming and are extremely hard to fix at the very least. If you haven't you could try to enable trimming on the .NET6 targeting branch and see how many errors you get. |
…ostfix on relevant winapi functions/structs, put ExactSpelling = true for winapi functions. We don't care for ANSI functions (no way somebody is going to run BizHawk on Windows 98/ME), and ExactSpelling = false (default) has a minor runtime cost, so this should be slightly more performant. Also, replace ShellLink COM usage with custom COM interaction code. See #3767. The same is yet to be done for the two other COM usages.
I tried adding <EnableAotAnalyzer>true</EnableAotAnalyzer>
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<TrimmerSingleWarn>false</TrimmerSingleWarn> but it just gave me the |
The trimming is somewhat weirdish. For each project you want to manually specify it in, you need to have at least .NET 6 targeted. However, in reality this isn't really needed per se (unless you're doing partial trimming and probably for warnings), since if you perform full trimming (the default), then specifying that for the exe project (assuming that is targeting .NET 6+) is enough for all assemblies used to be trimmed (even .NET Standard/.NET 5 and below ones). |
Something to look at wrt .NET6 (see #1415). One benefit of .NET6 is the ability to do a "self-contained" build which packs in all the framework and runtime (so no need for a prereq installer) (see also #1415). This however makes the build much larger. One way to reduce this size is to enable trimming, which removes unused code. (perhaps this might even give us an overall size reduction compared to a framework deployed build?)
However, trimming comes with several limitations:
Only used directly in BizHawk.Common, in ShellLinkImports.cs, Win32Imports.cs, and Win32ShellContextMenu.cs.No longer used since 4980725Maybe used in some deps wrapping around DirectX APIs? (DirectSound/XAudio2/DirectInput/XInput/Direct3D9?)The text was updated successfully, but these errors were encountered: