In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about the .NET Core runtime and how to improve the performance of the basic class library. The article is rich in content and analyzes and describes it from a professional point of view. I hope you can get something after reading this article.
Microsoft announced improvements to the. NET Core runtime and the performance of the underlying class library. Although not as much hype as improving the performance of ASP.NET Core, these improvements are equally important.
Among them, there are significant changes in the following 10 aspects: collection, LINQ, compression, encryption, mathematical operations, serialization, text processing, file Imax O, network and concurrency. How any set of performance changes affect a specific application depends on the specific usage pattern. The following discussion lists only a few key points to give you a general idea of these improvements. Many of these changes are based on open source Pull Request requests. In this way, some important changes that are not worth implementing for Microsoft because of its minimal overall impact can be implemented. These changes are important to a large number of developers.
Collections are widely used in almost any application. Many operations have been improved by simplifying collections or reducing complexity. Some of these improvements benefit from reduced overhead, such as simplifying operations for better inlining, or reducing the number of instructions. The constructor for SortedSet has been fixed because it was originally written in a simple way and is not very scalable when dealing with repetition. SortedSet's Min and Max do not need to traverse the entire tree. The speed of List.Add is faster. Not only System.Collections.Generic has been improved, but other namespaces such as System.Collections.Concurrent have also been improved. ConcurrentQueue and ConcurrentBag are basically rewritten. LINQ user applications can feel the performance improvement only from the improvement of the collection.
In addition, the performance of LINQ itself is also an improvement. To reduce the number and size of memory allocations and to simplify algorithms, many operators of the. NET Core are overridden For example, Enumerable.Concat ensures linear growth instead of exponential growth when concatenating multiple Enumerable. The ToList and Select operators are simplified to reduce memory allocation and the use of delegates and interfaces, while minimizing field reads and writes and avoiding replication. Enumerable.ToArray now manages internal buffers better.
Unlike collection and LINQ operation memory, compression is usually limited by CPU. For example, DeflateStream now uses a native decompression library. The native decompression library has also been optimized.
In terms of encryption, SHA256.Create uses a native implementation, such as CNG on Windows or OpenSSL on Unix.
The performance of mathematical operations in operating BigInteger has been improved.
Binary serialization is CPU, data, and memory intensive. .net Core 2.0 adds BinaryFormatter and allows the O (N) algorithm to take longer before switching to the O (N2) algorithm. Larger serialization inputs can now be processed more quickly.
For text processing, Regex.IsMatch is more efficient in memory allocation, and garbage collection is more efficient due to changes in the way data is cached. WebUtility.UrlDecode no longer decodes the input that is not actually needed. Microsoft has made loop optimizations for some built-in Encoding-derived types.
Microsoft has also made many improvements to string manipulation. Enum.Parse is more efficient in terms of memory usage, so garbage collection is also more efficient. Various ToString methods have also been improved. The methods of the String class itself have also been improved, such as IndexOf and StartsWith. Given the heavy use of strings in applications, this improvement should have a huge impact.
The file Imap O has been improved. FileStreams, which uses asynchronous read and write, is now more efficient.
The underlying network protocol stack has been improved. Asynchronous sockets now allow such operations to actually be done synchronously, thus avoiding the overhead of asynchronous completion. These types of changes have a great impact on upper-level functions that use socket primitives. Work related to upper network classes such as NetworkStream and SslStream is also a source of improvement.
Changes to concurrency and parallelism have been carried out. Many .NET applications use the ThreadPool class. For example, QueueUserWorkItem replaces the global queue with a queue with synchronous control and less memory allocation, greatly reducing garbage collection. For synchronization primitives like SpinLock, improvements have been under way. SpinLock.TryEnter has been improved to fail more quickly when the lock cannot be acquired immediately. This improvement has resulted in a significant performance improvement for popular execution paths that use this class.
In this round of performance improvement, about 1000 Pull Request have been merged, and there is still a lot of work to be done. In summary, performance improvement is a higher priority in terms of adding performance-based API and improving existing libraries.
BenchmarkDotNet has done some independent tests on these changes.
This is how the performance of the .NET Core runtime and basic class libraries has been improved. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.