`SetDefaultObservableSystem` causes continuous minor CPU usage
I tried the SetDefaultObservableSystem in WinUI and WPF with the extension method. Even with a blank window, after executing this extension method, I can observe continuous CPU usage of about 0.1% - 0.2% in Task Manager. For a desktop application with no interaction, I would expect the CPU usage to remain at 0%. However, when not using the extension method and using ObserveOn with the dispatcher context, there is no issue.
Thank you.
The frame check hooked into CompositionTarget.Rendering might have more impact than I expected.
Usually there's no frame processing, so it only involves incrementing a long value and doing a volatile read to check the Empty Length.
Considering there are other processes within WPF, I thought it would effectively be zero-cost, so I was surprised to find that wasn't the case.
While Rendering events are normally not registered, they are automatically and permanently registered by the FrameProvider, causing continuous event firing attempts.
The firing of WPF rendering events is somewhat costly.
Since FrameProvider isn't always necessary, I will provide options to either not register the FrameProvider or to remove it.
The current workaround is to register the TimeProvider manually, without using SetDefaultObservableSystem.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.