dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.04k stars 1.17k forks source link

ReadyToRun images are not as efficient for .NET Core 3 as NGen for .NET Framework #1748

Open AlexChuev opened 5 years ago

AlexChuev commented 5 years ago

P.S. I'm posting this in the WPF repo because the difference between Ngen.exe and ReadyToRun images highly affects WPF applications. Normally, the JIT compiler processes classes and methods only when they are needed for the program execution. However, when WPF loads theme resources for a control, this causes all classes referenced in these resources (including classes referenced in currently unused or invisible parts) to be processed by the JIT compiler. In addition, static constructors of many WPF classes contain the DependencyProperty registration code that may cause even more classes and methods to be JITted.

rladuca commented 5 years ago

@fadimounir Where should we file a companion bug on .NET?

fadimounir commented 5 years ago

@rladuca Sure you can file a companion bug on dotnet/coreclr. We'd be interested in diagnosing this more, although one thing to keep in mind is that R2R by design principle will always be a bit slower than fragile native images, because they are version resilient (they do not have the same fragility as old ngen images).

If you need published apps or other samples for your tests, please let me know.

@AlexChuev That would be very helpful

cc @jkotas FYI

grubioe commented 5 years ago

New CoreCLR issue created, keeping open in WPF repo for tracking purposes.

lindexi commented 2 years ago

The other startup performance:

ekalchev commented 6 months ago

Please look at this issue. It basically negates all performance benefits from .net core for desktop apps making it slower than .net framework. We are currently migrating .net framework WPF app to .net core and we were unpleasantly surprised that it got slower startup times. This issue affect the entire class of desktop application.

The main issue we see is the JIT times. It seems NGEN 20 years old technology is 3 times better eliminating JIT than Ready2Run. Unbelievable.

lindexi commented 6 months ago

Should we modified the milestones from 7.0 to 9.0?

pchaurasia14 commented 6 months ago

@lindexi - This one would require some in-depth investigations at our end and I don't think we'll be able to address this for .NET 9. I'm marking this to future release for now and will change it to .NET 9 if we can get to this sooner.

ekalchev commented 6 months ago

@lindexi - This one would require some in-depth investigations at our end and I don't think we'll be able to address this for .NET 9. I'm marking this to future release for now and will change it to .NET 9 if we can get to this sooner.

Honestly, I don't know what are you planning for .net9 but it will be irrelevant if ppl stop using WPF. And this is one of the most important properties of a desktop app - startup time. When .net core progress, we expected startup time to improve because of all the optimizations promised by .net runtime, but it got worse and nobody do anything about it - for years!

I hoped you'll fix it in .net6, now the best estimate is .net10? Lets face it - we just need to move away from that shit WPF and stop waiting for any improvements. I don't know what is so important for .net9 that you are planning that takes precedence of embarrassingly slow XAML parser. May be some Win11 styling that we can do ourselves but not the fix for fu cking XAML parser that we can't fix by our own.