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

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

Open
AlexChuev opened this issue Aug 29, 2019 · 8 comments
Labels
issue-type-tracking-external To track dependencies with other teams or repos
Milestone

Comments

@AlexChuev
Copy link

  • .NET Core Version: 3.0 Preview 8
  • Windows version: 1809
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: No
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No

Problem description:
Since Ngen.exe and Native Image Task are not available in .NET Core 3, ReadyToRun images are the only way to reduce the application startup time and avoid delays caused by JIT compilation. However, our tests show that for the same WPF application that initializes three times faster after using Ngen.exe, ReadyToRun images provide the difference of only 25%.
This is a huge hit for our users, since with many libraries and theme resources, JIT compilation is one of the main factors affecting load times. For some real-life applications, the use of Ngen.exe allowed our users to shave up to 6 seconds (half) off the initial start time.

Minimal repro:
You can find samples for .NET Core 3 and .NET Framework here: https://github.com/AlexChuev/ReadyToRunPerformanceTest
These samples use DevExpress WPF assemblies to demonstrate how Ngen.exe and ReadyToRun images affect projects with many classes and theme resources. If you need published apps or other samples for your tests, please let me know.

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
Copy link
Member

rladuca commented Aug 29, 2019

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

@fadimounir
Copy link

@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 grubioe added the issue-type-tracking-external To track dependencies with other teams or repos label Aug 29, 2019
@grubioe grubioe added this to the 3.1 milestone Aug 29, 2019
@grubioe
Copy link
Contributor

grubioe commented Aug 29, 2019

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

@lindexi
Copy link
Member

lindexi commented May 16, 2022

The other startup performance:

@ekalchev
Copy link

ekalchev commented Mar 1, 2024

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
Copy link
Member

lindexi commented Mar 1, 2024

Should we modified the milestones from 7.0 to 9.0?

@pchaurasia14
Copy link
Member

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

@pchaurasia14 pchaurasia14 modified the milestones: 7.0.0, Future Mar 1, 2024
@ekalchev

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue-type-tracking-external To track dependencies with other teams or repos
Projects
None yet
Development

No branches or pull requests

8 participants