Skip to content
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

Open
lindexi opened this issue Oct 10, 2019 · 8 comments
Open

Using win32 to show the splash screen #2031

lindexi opened this issue Oct 10, 2019 · 8 comments
Labels
Performance Performance related issue
Milestone

Comments

@lindexi
Copy link
Member

lindexi commented Oct 10, 2019

The advantage is that


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.

@weltkante
Copy link

weltkante commented Oct 10, 2019

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.

@lindexi
Copy link
Member Author

lindexi commented Oct 10, 2019

@weltkante Thank you. But not at all, see https://github.com/kkwpsv/SplashImage and I will edit my summary.

@weltkante
Copy link

weltkante commented Oct 10, 2019

But not at all

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 ...

@lindexi
Copy link
Member Author

lindexi commented Oct 10, 2019

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.

@kkwpsv
Copy link

kkwpsv commented Oct 10, 2019

But not at all

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 @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?

@weltkante
Copy link

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.

@mikedn
Copy link

mikedn commented Oct 10, 2019

so probably comparable to loading GDI+

And GDI+ uses WIC internally so by using GDI+ you'll probably end up loading both and wasting more time.

@kkwpsv
Copy link

kkwpsv commented Oct 10, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Performance related issue
Projects
None yet
Development

No branches or pull requests

5 participants