You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Startup: telemetry initialization on the main thread adds about 22 ms on Windows #28373
ConsoleHost calls ApplicationInsightsTelemetry.SendPSCoreStartupTelemetry before it runs the command. The static constructor of ApplicationInsightsTelemetry first calls WindowsDataCollectionSetting.CanCollectDiagnostics (added in #27328), which initializes WinRT and activates Windows.System.Profile.PlatformDiagnosticsAndUsageDataSettings, and then creates the Application Insights client. All of this runs on the main thread before the user's command.
With POWERSHELL_TELEMETRY_OPTOUT=1, pwsh -NoProfile -NonInteractive -Command exit (7.6.9 x64, i9-10900K, 30 interleaved runs, median of paired differences with 95% confidence interval):
difference with opt-out
Windows 11 26100
-22.3 ms (14.0 to 28.9)
Ubuntu 26.04 on the same machine (WSL2)
0.0 ms (-5.6 to 8.2)
The WinRT query alone, in a small C program, costs 13 ms and loads 13 extra DLLs.
Move the telemetry initialization, including the Windows setting check, off the start-up path, for example into the task that sends the start-up event, so CanSendTelemetry is resolved in the background. The opt-out stays the same because the environment variable is checked first.
Activity