This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3878|Reply: 1

[Communication] [Turn]. NET 8 Newly Added High-Performance Types

[Copy link]
Posted on 5/7/2023 9:37:47 AM | | |
preface

. Net8 version, compared to. Net7 has changed a lot. In this article, let's take a look at some of its types of performance changes, officially recommended new types aimed at improving application performance.

wraparound

1.System.Collections.Frozen

Namespaces include the collection types FrozenDictionary< TKey, TValue> and FrozenSet. Once a collection is created, these types do not allow any changes to keys and values. This requirement enables faster read operations (e.g., TryGetValue()). These types are especially useful for collections that are populated at first use and then retained for long-term service, such as:

2.System.Buffers.IndexOfAnyValues

The type is intended to be passed to the method of finding the first match of any value in the passed collection. For example, String.IndexOfAny(Char[]) looks for the first match of any character in the specified array in the string that calls it. NET 8 adds new method overloads, such as String.IndexOfAny and MemoryExtensions.IndexOfAny that accept new type instances. When you create an instance of System.Buffers.IndexOfAnyValues, all the data needed to optimize subsequent searches will be derived at that time, which means that the work is done upfront.

3.System.Text.CompositeFormat

Types can be used to optimize format strings that are unknown at compile time (e.g., format strings are loaded from resource files). It takes some extra time up front to do things like parsing strings, but this saves work done every time you use it.

4.System.Buffers.IndexOfAnyValues

The type is intended to be passed to the method of finding the first match of any value in the passed collection. For example, String.IndexOfAny(Char[]) looks for the first match of any character in the specified array in the string that calls it. NET 8 adds new method overloads, such as String.IndexOfAny and MemoryExtensions.IndexOfAny that accept new type instances. When you create an instance of System.Buffers.IndexOfAnyValues, all the data needed to optimize subsequent searches will be derived at that time, which means that the work is done upfront.

5.System.Text.CompositeFormat

Types can be used to optimize format strings that are unknown at compile time (e.g., format strings are loaded from resource files). It takes some extra time up front to do things like parsing strings, but this saves work done every time you use it.

6. System.Numerics and System.Runtime.Intrinsics

Improvements to the System.Numerics and System.Runtime.Intrinsics namespaces. Vector256, Matrix3x2, and Matrix4x4 improve hardware acceleration on .NET 8. For example, Vector256 has reimplemented 2xVector128 where possible. Hardware internals now annotate using the ConstExpected property. This ensures that users know when the underlying hardware needs constants and when extraordinary values may accidentally harm performance.

Reference:The hyperlink login is visible.
Original:The hyperlink login is visible.





Previous:VSTO (VI) cancels or blocks the Word document from being saved
Next:ASP.NET Core (18) Customize a simple OutputCache output cache
Posted on 5/7/2023 3:36:17 PM |
Learn to learn
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com