官术网_书友最值得收藏!

Performance improvements

Some of the more interesting changes in .NET Core 2.0 are performance improvements over the original .NET Framework. There have been tweaks to the implementations of many framework data structures. Some of the classes and methods that have seen speedy improvements or memory reduction include:

  • List<T>
  • Queue<T>
  • SortedSet<T>
  • ConcurrentQueue<T>
  • Lazy<T>
  • Enumerable.Concat()
  • Enumerable.OrderBy()
  • Enumerable.ToList()
  • Enumerable.ToArray()
  • DeflateStream
  • SHA256
  • BigInteger
  • BinaryFormatter
  • Regex
  • WebUtility.UrlDecode()
  • Encoding.UTF8.GetBytes()
  • Enum.Parse()
  • DateTime.ToString()
  • String.IndexOf()
  • String.StartsWith()
  • FileStream
  • Socket
  • NetworkStream
  • SslStream
  • ThreadPool
  • SpinLock

We won't go into specific benchmarks here because benchmarking is hard and the improvements you see will clearly depend on your usage. The thing to take away is that lots of work has been done to increase the performance of .NET Core. Many of these changes have come from the community, which shows one of the benefits of open source development. Some of these advances will probably work their way back to a future version of the regular .NET Framework too.

There have been improvements made to the RyuJIT Just In Time compiler for .NET Core 2 as well. As just one example, finally blocks are now almost as efficient as not using exception handling at all, which is beneficial in a normal situation where no exceptions are thrown. You now have no excuses not to liberally use try and using blocks, for example, by the checked arithmetic to avoid integer overflows.

主站蜘蛛池模板: 苍山县| 庐江县| 正安县| 雅安市| 大同市| 盐边县| 桂平市| 金溪县| 松原市| 丹寨县| 大丰市| 汨罗市| 岐山县| 敖汉旗| 年辖:市辖区| 潮安县| 崇文区| 上杭县| 张家界市| 五华县| 台北市| 呼伦贝尔市| 绵阳市| 始兴县| 兴仁县| 乌鲁木齐市| 邹平县| 嘉定区| 中阳县| 西和县| 南江县| 滨州市| 清水河县| 临夏县| 青河县| 黎平县| 梨树县| 那坡县| 广宗县| 长垣县| 柏乡县|