-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Remove calls to Console.WriteLine to decrease app size #11405
Copy link
Copy link
Closed
Labels
area-controls-webviewWebViewWebViewarea-essentialsEssentials: Device, Display, Connectivity, Secure Storage, Sensors, App InfoEssentials: Device, Display, Connectivity, Secure Storage, Sensors, App Infofixed-in-8.0.0-preview.1.7762Look for this fix in 8.0.0-preview.1.7762!Look for this fix in 8.0.0-preview.1.7762!perf/generalThe issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)proposal/open
Milestone
Description
Description
It seems there are a few calls to Console.WriteLine in MAUI from:
- Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
- System.Boolean Microsoft.Maui.Handlers.WebViewHandler::LoadFile(System.String)
- Microsoft.Maui.Essentials, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
- System.Boolean Microsoft.Maui.Authentication.WebAuthenticatorImplementation::OpenUrlCallback(System.Uri)
The whole Console machinery is quite expensive (size-wise), and removing the Console.WriteLine in these calls is likely to provide a significant size improvement for iOS apps.
For a sample test app here are some rough numbers:
- System.Console.aotdata.arm64: 46.432 bytes
- System.Console.dll: 9.728 bytes
- Object files for System.Console.dll: 415.748 bytes
- Total: 471.908 bytes
Note that this does not take into account any additional savings where API in other assemblies can be removed because System.Console was the only caller.
Public API Changes
N/A
Intended Use-Case
Size-optimized release builds.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-controls-webviewWebViewWebViewarea-essentialsEssentials: Device, Display, Connectivity, Secure Storage, Sensors, App InfoEssentials: Device, Display, Connectivity, Secure Storage, Sensors, App Infofixed-in-8.0.0-preview.1.7762Look for this fix in 8.0.0-preview.1.7762!Look for this fix in 8.0.0-preview.1.7762!perf/generalThe issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)proposal/open