-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Dotnet 8, Avalonia UI migration #617
Comments
The first read is slow because all files need to be read from disk. The second read is faster, because the OS has cached the files. So I wonder how DotNet 8 can improve this. And if we don't read all RESX files, how can we detect missing entries? |
Hello @tom-englert, With the introduction of .NET 8, a multitude of performance enhancements have been implemented. These improvements become particularly noticeable when compared to the .NET Framework. By utilizing Ahead-of-Time (AOT) compilation when building your application, you can reap the benefits of faster startup times and improved performance. Furthermore, AOT compilation of ResourceReader and Writer (using a custom implementation with XDocument) also contributed to superior performance. |
@tom-englert My understanding is the same as yours i.e. subsequent reads must be faster due to the OS cache. The file read time with AOT and DotNet framework should be same. I did a quick test with a set of 2K .resx files for three languages, each with ten strings. So total (2000x10x3) 60K strings. Time measured with a stopwatch. So, it is approx. value. The RESX Manager took 15 seconds and Localizer PoC took less than 2.5 seconds. I have no clear understanding about the reasons. These readings were for subsequent reads. The time is for read + render. |
Maybe the difference here is because you compare an minimal prototype with a full featured application. Also to mention: The primary use case is Visual Studio extension, the standalone app is just a nice to have side effect, so before starting any migration, we would have to ensure this will still run in the context of Visual Studio. Maybe https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/visualstudio-extensibility is the key to run an extension out of process. |
To get the diff between NetFramework and DotNet8, you can just add Net8 to the target frameworks of the projects in ResXManager, then you can try it for both frameworks with ResXManager. |
@praful-hunde any new findings? |
@tom-englert & @sps014 So far findings are as below:
|
My two cents: Would it be possible to disable many of the features, so that they do not start up immediately? I too get very slow performance in Visual Studio using the vsix extension.
|
What features are you thinking of? The time on startup is spent on enumerating all files in the project and collecting the .resx files. In the standalone version the file system is used to enumerate all files, while in Visual Studio the DTE interfaces are used to enumerate all projects and their files, so here it's Visual Studio causing some slow down. However file system seems to be the bottle neck, even in Visual Studio when opening the solution a second time it is much faster. |
I am not sure what features - it's all good :) |
The Problem
The current Dotnet framework build works great for the purpose. But for large source code with hundreds of .RESX files, the first read takes a few minutes. In my case reading more than 20k entries from a few hundred files takes about 2.5 minutes. As per observation, the subsequent reads are faster and only take a few seconds. However, the first read is more painful for daily use. There is indeed no need to read all RESX files every time, for typical use. However, we do it to reuse the translations from the past. This feature is in our internal copy of the code. The existing translations can be re-used if an exact match is found. The motivation is to avoid the double cost of translations by a third party.
The Solution
Migrating to Dotnet 8 is one potential solution. My collogue tried a PoC with Dotnet 8 and Avalonia UI to check read and render performance. With AOT build the app is blazingly fast, even for the first read. The code is available at https://github.com/sps014/Localizer.
Apart from gaining performance potentially, the tool can become cross-platform by adopting Dotnet 8 and Avalonia UI
The alternatives
In my local copy, I could gain performance benefits with Parallel Foreach, PLINQ, and WPF Async binding. The performance improvement is not as significant as observed in PoC. But this is still can be a good gain with minimal changes.
The text was updated successfully, but these errors were encountered: