-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Using win32 to show the splash screen #2031
Comments
WPF is already using plain win32 to show the splash screen (i.e. the splash screen is not a WPF window). The performance difference you see must come from somewhere else. |
@weltkante Thank you. But not at all, see https://github.com/kkwpsv/SplashImage and I will edit my summary. |
I don't see the difference, both the WPF code and your linked example use CreateWindow API to create a native window. They then use different native APIs for showing the image, but that shouldn't make much of a difference, if anything the WPF code using plain GDI should be faster than your sample which first needs to load the GDI+ library. The performance difference must be coming from somewhere else than creating and showing the window. In fact, if you look at the WPF source I linked and scroll up the resource lookup says it can be pretty slow (200-300ms) so I suspect the fact that WPF wants to localize the splash screen is what makes up for the performance difference. Maybe adding support for other sources of splash screen images (like you requested) will fix the performance difference. I don't think the window logic itself needs to be changed, just the image lookup. In either case your issue title is not accurate, WPF already uses win32 API to show the splash screen, what you are asking about is to make it faster and more flexible ... |
@weltkante Yes, I updated my summary but I do not find a good title. |
@weltkante @lindexi GDI+ is used for gif transparent image. And from the code i can see that WPF use WIC to load Image. May this cause performance difference? |
Yes loading WIC costs time, but its a native component (no JIT) so probably comparable to loading GDI+ in the other example. Considering the comment I linked already says resource loading slows down by 200-300ms, and OP is saying WPF is ~200ms slower than the other example, there is very little ambiguity where it comes from (assuming the comment isn't outdated). Any further speculation doesn't make much sense without doing actual profiling or measurements. |
And GDI+ uses WIC internally so by using GDI+ you'll probably end up loading both and wasting more time. |
Yes, maybe we should do profiling to get the real reason. But now splash image in WPF has a noticeable delay before it is displayed. While in the example we can see the splash image immediately. We have a bad experience with delay, and want to see it immediately. This is the main purpose for this issuses. |
The advantage is that
The sample https://github.com/kkwpsv/SplashImage cost 100ms and the native WPF splash screen cost 300ms. But I do not use benchmark tests. And it slower than UWP.
The WPF can only use the resource file. That means we should use the WPF windows with an image to show the splash screen when we use the file path. But we use WPF windows as splash screen and we will find Creating multi-thread UI has a low probability to crash #297 and Creating multi-thread UI has a very very low probability to crash #298
Thanks @weltkante the WPF uses win32 method to show the splash screen and my title is not all right. But the code need many WPF feature. And I suggest that we can use all win32 methods to create a splash screen that means that this code can run in a console project.
The text was updated successfully, but these errors were encountered: