In previous blogs, we discussed the benefits of upgrading source code. Today we are going to look at the improvements made upgrading from .NET Core 3.1 to . Net 5. There are some major changes between .NET Core 3.1 and .Net 5 that are intended to make it run more effectively than the previous source code. We have been working on upgrading several of our clients’ software to .NET 5 and highly recommend it. Upgrading one upgrade at a time as opposed to doing bulk upgrades makes the process so much smoother. We’ll discuss the following areas to help you understand why .Net 5 is so much faster:
- Framework library changes
- JSON Handling
- App Trimming
In addition, we’ll discuss how upgrading to .Net 5 will help spread the costs associated with upgrading to .Net 6 which aims to unify all .Net runtimes into a single platform.
Framework Library Changes
.Net 5 changes the way Microsoft is approaching Framework libraries. In past source codes there may have been multiple framework libraries for different apps. This change is intended to make it where there is a single framework that apps interact with. It is meant to replace .NET Standard and .NET Core in future development, but is compatible with previous framework libraries so that it does not render other frameworks useless. Microsoft guidance basically suggests the following approach for when to use the new library or old libraries:
- Use netstandard2.0 to share code between .NET Framework and all other platforms.
- Use netstandard2.1 to share code between Mono, Xamarin and .NET Core 3.x.
- Use net5.0 for code sharing moving forward.
Eventually, it will become necessary for all apps to be upgraded, but no date is officially known.
The change is meant to make app building easier by using one framework for all apps. This can also have the added benefit of the framework being stored in cache so that anytime someone accesses one of your apps, the framework is already there and does not have to be transmitted again. That should make the speed of your apps faster after the first use.
JSON Handling
JSON is a means of storing data where it can be easily accessed later. There were numerous changes that were made to make pulling up information easier and faster. You can see a full list of the changes at https://docs.microsoft.com/en-us/dotnet/core/dotnet-five, but as you can see in the graphs below, there is a 12%+ increase in the number of requests per second that can be processed and a minimum of a 4.2% decrease in latency, the delay of transferring data. What this means is your apps benefit tremendously in how much they can handle with the same amount of RAM and computational power. Imagine how much better your business can perform if it can handle 12% growth with the same assets it has today. That will make shareholders happy.
Source: Microsoft
App Trimming
App trimming is the process of removing unnecessary code from an app to trim the size of the app. The newest trimming features allow 3 layers of trimming compared to one layer previously. In a test by Microsoft of a fairly simple app, they established that app trimming can reduce the size of the application by up to 66% at the assembly level and another 11% at the member level. These numbers are based on the +R2R statistics because the additional size of Ready-to-Run increases the speed of the startup.
As you can see, .NET 5 offers some substantial changes that help reduce the size and speed up applications. When upgrading applications, care should be taken because some of these features may impact how your current system operates. For instance there may be mapping required due to the framework changes, or you may have to check to make sure the app trimming didn’t accidentally remove necessary parts of code.
These changes are building to .NET 6, where the goal is to provide a single platform to create apps for all of Microsoft’s offerings. By starting to change over to some of the features, you can spread the cost over a longer period of time (potentially 2 years). Upgrading one upgrade at a time also makes the process so much smoother. This should reduce your monthly expenditure while getting your applications using a single faster platform.
We have been working on upgrading several of our clients’ software to .NET 5 and highly recommend it. Flying Donkey IT is always happy to help you figure out the best path forward with a free consultation. Just send an email to schedule a talk with me, Mathew Grace.
Cheers.