1. 程式人生 > >【翻譯】.NET 5 Preview2釋出

【翻譯】.NET 5 Preview2釋出

在4月2日,釋出了.NET 5.0 Preview2,這次釋出對一些功能和效能做了相關的改進,同時後面也會實施5.0版本更多的功能,其中一些功能目前也[dotnet/designs](https://github.com/dotnet/designs/pulls)在[.NET 5 Preview1](https://devblogs.microsoft.com/dotnet/announcing-net-5-0-preview-1/)中可以看到.NET 5里程碑中已經完成的建設任務,當然可以檢視相關的設計資料進行反饋,同時可以下載Preview2並進行測試他。 可以在Windows MacOS和Linux下載[.NET 5 Preview2](https://dotnet.microsoft.com/download/dotnet-core/5.0) - [.NET 5 Preview2 And Runtimes](https://dotnet.microsoft.com/download/dotnet-core/5.0) - [Docker Images](https://hub.docker.com/_/microsoft-dotnet-core) - [Snap Installer](https://snapcraft.io/dotnet-sdk) [ASP.NET Core](https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-5-preview-2/)和[EF Core](https://devblogs.microsoft.com/dotnet/announcing-entity-framework-core-5-0-preview-2/)也在當天釋出。 必須要使用[Visual Studio 2019 16.6](https://devblogs.microsoft.com/visualstudio/visual-studio-2019-version-16-6-preview-2/)才可以使用.NET 5.0。安裝最新版本的C# 擴充套件,將.NET 5.0在VisualStudio Code中使用,目前還不支援Mac的Visual Studio. 發行說明: - [.NET 5.0 Preview2發行說明](https://github.com/dotnet/core/blob/master/release-notes/5.0/preview/5.0.0-preview.2.md) - [.NET 5.0已知問題](https://github.com/dotnet/core/blob/master/release-notes/5.0/5.0-known-issues.md) - [GitHub中issues](https://github.com/dotnet/core/issues/4500) ## RyuJIT中程式碼質量的改進 每個版本都包含著一些更改,這些更改可以改進JIT生成的機器程式碼(它被稱為“code quality”).更好的程式碼質量意味著更好的效能。總而言之,下面改進中一半的是實際的新優化,另一半是由於更改RyuJIT的流程而使現有優化能夠應用到更多的程式碼中. - [Use xmm for stack prolog – dotnet/runtime #32538 ](https://github.com/dotnet/runtime/pull/32538) 更改為x86/x64 prolog歸零程式碼,改進:Json; - [Add ValueNumbering support for GT_SIMD and GT_HWINTRINSIC tree nodes – dotnet/runtime #31834 ](https://github.com/dotnet/runtime/pull/31834)—為SIMD和硬體固有型別啟用優化器。 - [Use GT_NULLCHECK for unconsumed indirections – dotnet/runtime #32641](https://github.com/dotnet/runtime/pull/32641)—刪除冗餘null檢查。 - [invoke nullable box optimizations earlier – dotnet/runtime #32269](https://github.com/dotnet/runtime/pull/32269)—改善優化Nullable。 - [Optimize range checks for various array index patterns – dotnet/runtime #1644](https://github.com/dotnet/runtime/pull/1644)-消除 **range checks** 的改進。 - [Optimize obj.GetType() != typeof(X) for sealed classes – dotnet/runtime #32790](https://github.com/dotnet/runtime/pull/32790)-改進了型別檢查表示式。 - [Eliminate duplicate zero initializations more aggressively – dotnet/runtime #31960](https://github.com/dotnet/runtime/pull/31960)—更好和更廣泛的方法,以消除重複零初始化。 - [Fix method and basic block flags used by early opts – dotnet/runtime #2196](https://github.com/dotnet/runtime/pull/2126) - 優化某些可以頻繁使用,現在更經常地用常數替換陣列長度。 ## 垃圾收集器 - [Card mark stealing – dotnet/coreclr #25986](https://github.com/dotnet/coreclr/pull/25986)- 伺服器GC(位於不同執行緒上)可以在標記由較早一代物件保留的gen0/ 1物件時進行執行獲取。 這意味著,對於某些GC執行緒要花費更長的時間進行標記的情況,短暫的GC暫停時間較短。 - [Introducing Pinned Object Heap – dotnet/runtime #32283](https://github.com/dotnet/runtime/pull/32283) — 實現了POH(Pinned Object Heap)功能的一部分– GC內部的一部分。 這個新的堆(本質上是LOH的對等體)將允許GC分別管理固定物件,從而避免固定物件對世代堆的負面影響。 - [Allow allocating large object from free list while background sweeping SOH – dotnet/runtime #2103](https://github.com/dotnet/runtime/pull/2103) — 當BGC清理SOH時,使用空閒列表啟用LOH分配。以前這只是在LOH上使用段空間的末端。這樣可以更好地使用堆。 - [Background GC suspension fixes – dotnet/coreclr #27729](https://github.com/dotnet/coreclr/pull/27729) -暫停修復程式減少了BGC和使用者執行緒被暫停的時間。 這樣可以減少發生GC之前掛起託管執行緒所需的總時間。 dotnet / coreclr#27578也有助於達到相同的結果。 - [Fix named cgroup handling in docker – dotnet/runtime #980](https://github.com/dotnet/runtime/pull/980) — - 添加了對從命名cgroup讀取限制的支援。以前,我們僅從全域性範圍內閱讀。 ## Closing 在容器,虛擬機器大家可以去嘗試Preview2。希望大家對.NET5提出並反饋意見。接下來幾個月裡面,將會有更多的版本釋出。最終將在11月釋出正式版本。 作為測試案例,目前.NET 5.0在Azure負載均衡上運行了[.NET網站](https://dotnet.microsoft.com/)的50%的流量. 自從釋出預覽版1天以來一直在上面這麼做了,也許大家還記得.NET Core3.0和3.1也這樣做過測試案例. 通過將流量分流為5/5,可以確保在不斷地效能資料情況下5.0將持續的改進變得更好。這種測試是公開的,也是一種很好的測試方法,目前用.NET5在核心網站的生產環境這將是對.NET5最大的信任,當然不建議大家這樣是喲經,建議等等.目前版本號在[網站](https://dotnet.microsoft.com/)的頁尾中可以看到。 來源:https://devblogs.microsoft.com/dotnet/announcing-net-5-0-preview-2/