WriteableBitmap performance increase.
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
WriteableBitmap is fast (in Release and Debug modes) but it seems to be even faster in XAML Hot Reload Debug mode.
This performance in some cases doubles the Release performance.
My proposal is to identify what makes WriteableBitmap so fast in XAML Hot Reload Debug mode and use the same logic to Release.
The code for performance verification is the simplest possible.
_while (true)
{
Modelo2.ModelUpdate();
Application.Current.Dispatcher.Invoke(() => writeableBitmap.WritePixels(all, Modelo2.video_array, Modelo2.stride, 0, 0));
}_
_public static void ModelUpdate()
{
Buffer.BlockCopy(background, 0, video_array, 0, all_bytes);
... Model update logic removed to simplify. Left just a simple clean background per frame.
frames_counter++;
}_
To get the FPS rate there is a timer set to 1 second that collects the value of time (using System.Environment.TickCount64) and frames.
If necessary I can provide the full code.
Contributor guide
Assessment
This issue has not been assessed yet.