性能优化:减少边界检查
我学到了
为什么?
.NET源码中类似的优化
https://github.com/dotnet/aspnetcore/blob/48cafd98da826be3a710cd37dbaefac1db08d1b7/src/Http/Http/src/Features/HttpRequestIdentifierFeature.cs#L44-L56
https://github.com/dotnet/runtime/blob/3d2917662ffe8993a59c4e924d49fe49e72be460/src/libraries/System.Private.CoreLib/src/System/Guid.cs#L63
原文
https://twitter.com/MrPeterLMorris/status/1585199548112064513
相关阅读
https://www.cnblogs.com/InCerry/p/Dotnet-Opt-Perf-You-Should-Set-Capacity-For-Collection.html