{"id":489383,"date":"2026-07-31T20:36:53","date_gmt":"2026-07-31T20:36:53","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=489383"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=489383","title":{"rendered":"\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u044f ArrayPool: \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0430 \u043f\u0440\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u2014 131 072 \u0431\u0430\u0439\u0442\u0430 \u0432 LOH"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0423\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0431\u0443\u0444\u0435\u0440\u043e\u043c \u043f\u0440\u0438 \u0430\u0440\u0435\u043d\u0434\u0435 \u0438\u0437 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.buffers.arraypool-1\" rel=\"noopener noreferrer nofollow\">ArrayPool<\/a>, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u044b\u0432\u043e\u0434\u044b.<\/p>\n<p>\u041f\u0443\u043b \u0431\u0435\u0440\u0443\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u0440\u0443\u043f\u043d\u044b\u0435: \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0442 85 000 \u0431\u0430\u0439\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0430 \u043e\u043d\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435\u043c. \u041d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u041f\u0443\u043b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u044d\u0442\u0443 \u043a\u0443\u0447\u0443, \u0430 <code>new<\/code> \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438. \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0434\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 \u0431\u0443\u0444\u0435\u0440 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432.<\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 n \u0431\u0430\u0439\u0442:<\/p>\n<ul>\n<li>\n<p><code>new byte[n] <\/code>\u2014 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u043f\u0430\u043c\u044f\u0442\u044c \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442\u0441\u044f;<\/p>\n<\/li>\n<li>\n<p><code>GC.AllocateUninitializedArray&lt;byte&gt;(n)<\/code> \u2014 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p><code>ArrayPool&lt;byte&gt;.Shared.Rent(n)<\/code> \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c Return \u2014 \u0430\u0440\u0435\u043d\u0434\u0430 \u0438\u0437 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0443\u043b\u0430.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0411\u0443\u0434\u0435\u0442 5 \u0438\u0441\u0442\u043e\u0440\u0438\u0439:<\/strong><\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u0443\u0444\u0435\u0440 \u043d\u0430 81 920 \u0431\u0430\u0439\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 131 072 \u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 LOH;<\/p>\n<\/li>\n<li>\n<p>\u0433\u0434\u0435 <code>Stream.CopyTo<\/code> \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 LOH, \u0430 \u0433\u0434\u0435 \u043d\u0435\u0442;<\/p>\n<\/li>\n<li>\n<p>\u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043f\u0443\u043b;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u044b\u0434\u0430\u0447\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u043b \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438 \u043e\u0442 \u0447\u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043e\u0431\u043e\u0438\u0445 \u043f\u0443\u043b\u043e\u0432 \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 epeshk <a href=\"https:\/\/habr.com\/ru\/articles\/723420\/\" rel=\"noopener noreferrer nofollow\">\u00abArrayPool&lt;T&gt;: \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438\u00bb<\/a>. \u0417\u0434\u0435\u0441\u044c \u0434\u0440\u0443\u0433\u043e\u0435: \u0442\u0435 \u0436\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u043d\u043e \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0437\u0430\u043c\u0435\u0440\u043e\u0432, \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u0438 \u0442\u0440\u0451\u0445 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430\u0445.<\/p>\n<p>\u041a\u043e\u0434 \u2014 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/ComboxSoftDeveloper\/PoolProof\" rel=\"noopener noreferrer nofollow\">PoolProof<\/a>. \u0427\u0435\u0442\u044b\u0440\u0435 \u043c\u0430\u0448\u0438\u043d\u044b:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u2116<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>CPU<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u042f\u0434\u0440\u0430\/\u043f\u043e\u0442\u043e\u043a\u0438<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0427\u0430\u0441\u0442\u043e\u0442\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041e\u0421<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>.NET 10<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u21161<\/p>\n<\/td>\n<td>\n<p align=\"left\">AMD Ryzen 9 5950X<\/p>\n<\/td>\n<td>\n<p align=\"left\">16 \/ 32<\/p>\n<\/td>\n<td>\n<p align=\"left\">3,4 \u0413\u0413\u0446, \u0434\u043e 4,9 \u0432 \u0442\u0443\u0440\u0431\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">Windows 10 1809<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\">10.0.5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u21162<\/p>\n<\/td>\n<td>\n<p align=\"left\">Intel Core i9-10900KF<\/p>\n<\/td>\n<td>\n<p align=\"left\">10 \/ 20<\/p>\n<\/td>\n<td>\n<p align=\"left\">3,7 \u0413\u0413\u0446, \u0434\u043e 5,3 \u0432 \u0442\u0443\u0440\u0431\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">Windows 10 22H2<\/p>\n<\/td>\n<td>\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">10.0.10<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u21163<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 \u00d7 Intel Xeon Silver 4314<\/p>\n<\/td>\n<td>\n<p align=\"left\">2\u00d716 \/ 64<\/p>\n<\/td>\n<td>\n<p align=\"left\">2,4 \u0413\u0413\u0446, \u0434\u043e 3,4 \u0432 \u0442\u0443\u0440\u0431\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">Windows Server 2022<\/p>\n<\/td>\n<td>\n<p align=\"left\">64<\/p>\n<\/td>\n<td>\n<p align=\"left\">10.0.1<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u21164<\/p>\n<\/td>\n<td>\n<p align=\"left\">Intel Xeon W-2255<\/p>\n<\/td>\n<td>\n<p align=\"left\">10 \/ 20<\/p>\n<\/td>\n<td>\n<p align=\"left\">3,7 \u0413\u0413\u0446, \u0434\u043e 4,5 \u0432 \u0442\u0443\u0440\u0431\u043e<\/p>\n<\/td>\n<td>\n<p align=\"left\">Windows Server 2022<\/p>\n<\/td>\n<td>\n<p align=\"left\">20<\/p>\n<\/td>\n<td>\n<p align=\"left\">10.0.1<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>BenchmarkDotNet 0.15.8, Release, .NET 8, 9 \u0438 10. \u041e\u0442\u0447\u0451\u0442\u044b \u0441\u043d\u044f\u0442\u044b \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0435 \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u043c, \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0432\u043f\u0430\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u044b \u0431\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041f\u0430\u0442\u0447-\u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430 \u2014 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435.<\/p>\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u044f 1. \u041e\u0442\u043a\u0443\u0434\u0430 \u0431\u0435\u0440\u0451\u0442\u0441\u044f 131\u00a0072<\/h2>\n<p>\u041f\u0443\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u043c\u0438 \u0434\u0432\u043e\u0439\u043a\u0438. \u041d\u043e\u043c\u0435\u0440 \u0431\u0430\u043a\u0435\u0442\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u2014 <a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/Buffers\/Utilities.cs\" rel=\"noopener noreferrer nofollow\">Utilities.cs<\/a>:<\/p>\n<pre><code class=\"cs\">\/\/ dotnet\/runtime, System\/Buffers\/Utilities.cs[MethodImpl(MethodImplOptions.AggressiveInlining)]internal static int SelectBucketIndex(int bufferSize){    \/\/ Buffers are bucketed so that a request between 2^(n-1) + 1 and 2^n is given a buffer of 2^n    \/\/ Bucket index is log2(bufferSize - 1) with the exception that buffers between 1 and 16 bytes    \/\/ are combined, and the index is slid down by 3 to compensate.    \/\/ Zero is a valid bufferSize, and it is assigned the highest bucket index so that zero-length    \/\/ buffers are not retained by the pool. The pool will return the Array.Empty singleton for these.    return BitOperations.Log2((uint)bufferSize - 1 | 15) - 3;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u043b\u044f 81 920 \u044d\u0442\u043e \u0431\u0430\u043a\u0435\u0442 13, \u0430 \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043d\u0451\u043c \u2014 131 072 \u0431\u0430\u0439\u0442\u0430. <\/p>\n<p>\u0421\u0442\u0440\u043e\u043a\u0430 <code>16 &lt;&lt; 13<\/code> \u2014 \u044d\u0442\u043e <code>16 * 2\u00b9\u00b3<\/code>: \u043f\u0443\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u043c\u0438 \u0434\u0432\u043e\u0439\u043a\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0438 \u0431\u0430\u0439\u0442, \u0438 \u043d\u043e\u043c\u0435\u0440 \u0431\u0430\u043a\u0435\u0442\u0430 \u0437\u0430\u0434\u0430\u0451\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u044c.<\/p>\n<pre><code class=\"cs\">\/\/ PoolProof, \u0432\u044b\u0432\u043e\u0434 dotnet run -c Release -f net10.0 -- extra=== \u0413\u0434\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0440\u043e\u0433 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 ===\u043f\u043e\u0440\u043e\u0433 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: 85 000\u043f\u0435\u0440\u0432\u0430\u044f \u0434\u043b\u0438\u043d\u0430 byte[], \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0430\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435: 84 976\u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u043d\u0435\u0451: 131 072\u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u043b\u0438\u043d\u0430, \u043e\u0441\u0442\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438: 84 975<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>84 976 + 24 = 85 000. \u0414\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0431\u0430\u0439\u0442\u0430 \u2014 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 x64: \u0441\u0438\u043d\u0445\u0440\u043e\u0431\u043b\u043e\u043a, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0442\u0438\u043f\u0430, \u0434\u043b\u0438\u043d\u0430. \u041a \u044d\u0442\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0432\u0435\u0440\u043d\u0443\u0441\u044c \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438: \u0435\u0441\u043b\u0438 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u043f\u043e\u0440\u043e\u0433, \u0442\u0435 \u0436\u0435 24 \u0431\u0430\u0439\u0442\u0430 \u043e\u0442\u043d\u0438\u043c\u0443\u0442\u0441\u044f \u043e\u0442 \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b. \u041d\u0430 \u043a\u0430\u043a\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u043f\u0443\u043b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 LOH, \u0445\u043e\u0442\u044f \u0431\u0435\u0437 \u043f\u0443\u043b\u0430 \u043e\u043d \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0431\u044b \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u0443\u0447\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0417\u0430\u043f\u0440\u043e\u0441, \u0431\u0430\u0439\u0442<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0411\u0430\u043a\u0435\u0442<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0414\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0431\u0430\u0439\u0442<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0412 LOH<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0410 \u0431\u0435\u0437 \u043f\u0443\u043b\u0430<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">65 536<\/p>\n<\/td>\n<td>\n<p align=\"left\">12<\/p>\n<\/td>\n<td>\n<p align=\"left\">65 536<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">65 537<\/p>\n<\/td>\n<td>\n<p align=\"left\">13<\/p>\n<\/td>\n<td>\n<p align=\"left\">131 072<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">81 920<\/p>\n<\/td>\n<td>\n<p align=\"left\">13<\/p>\n<\/td>\n<td>\n<p align=\"left\">131 072<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">84 975<\/p>\n<\/td>\n<td>\n<p align=\"left\">13<\/p>\n<\/td>\n<td>\n<p align=\"left\">131 072<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">84 976<\/p>\n<\/td>\n<td>\n<p align=\"left\">13<\/p>\n<\/td>\n<td>\n<p align=\"left\">131 072<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u0411\u0430\u043a\u0435\u0442 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d \u043f\u043e <\/em><code><em>SelectBucketIndex<\/em><\/code><em>, \u043f\u043e\u0440\u043e\u0433 \u0434\u043b\u044f <\/em><code><em>byte[]<\/em><\/code><em> \u0432\u0437\u044f\u0442 \u0438\u0437 \u043e\u0442\u0447\u0451\u0442\u0430 <\/em><code><em>extra<\/em><\/code><\/p>\n<p>\u041f\u0443\u043b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u043e\u0442 65 537 \u0434\u043e 84 975 \u0431\u0430\u0439\u0442. <code>new<\/code> \u043d\u0430 \u044d\u0442\u0438\u0445 \u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438. \u041d\u0438\u0436\u0435 65 537 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u0451\u0442 65 536 \u0438 \u0432 LOH \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442. \u0421 84 976 \u0431\u0430\u0439\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0434\u0451\u0442 \u0432 LOH \u0438 \u0431\u0435\u0437 \u043f\u0443\u043b\u0430. \u0411\u0443\u0444\u0435\u0440 <code>CopyTo<\/code> \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u044d\u0442\u043e\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d.<\/p>\n<p>\u0417\u0430\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0439: 16, 32 \u0438 64 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u043e 81 920 \u0431\u0430\u0439\u0442 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b19\/fde\/b3e\/b19fdeb3e00cf9a769110697f437a36d.png\" alt=\"\u041f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0431\u0443\u0444\u0435\u0440\u044b \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0442\u0440\u0451\u0445 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430\u0445 \u0438 \u043e\u0431\u043e\u0438\u0445 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430\u0445\" title=\"\u041f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0431\u0443\u0444\u0435\u0440\u044b \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0442\u0440\u0451\u0445 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430\u0445 \u0438 \u043e\u0431\u043e\u0438\u0445 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430\u0445\" width=\"1320\" height=\"675\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/b19\/fde\/b3e\/b19fdeb3e00cf9a769110697f437a36d.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b19\/fde\/b3e\/b19fdeb3e00cf9a769110697f437a36d.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u041f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0431\u0443\u0444\u0435\u0440\u044b \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0442\u0440\u0451\u0445 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430\u0445 \u0438 \u043e\u0431\u043e\u0438\u0445 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430\u0445<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>16 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438\u0437 \u043f\u0443\u043b\u0430 \u0434\u0430\u044e\u0442 2 048 \u041a\u0411, \u0440\u043e\u0432\u043d\u043e \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043f\u043e 131 072 \u0431\u0430\u0439\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>32 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0430\u044e\u0442 4 097 \u041a\u0411 \u043f\u0440\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 4\u00a0096;<\/p>\n<\/li>\n<li>\n<p>64 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0430\u044e\u0442 8 195 \u041a\u0411 \u043f\u0440\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 8\u00a0192;<\/p>\n<\/li>\n<li>\n<p>new \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0434\u0430\u0451\u0442 \u043d\u043e\u043b\u044c: 81 920 \u0431\u0430\u0439\u0442 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043c\u0435\u0440 \u0438\u0434\u0451\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c. \u0418\u043d\u0430\u0447\u0435 32 \u0431\u0443\u0444\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0443\u0442\u0441\u044f \u0438\u0437 \u0442\u0435\u0445, \u0447\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u043b \u0432 \u043f\u0443\u043b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0437\u0430\u043c\u0435\u0440, \u0438 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0432\u0434\u0432\u043e\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e.<\/p>\n<p>\u0425\u0443\u0434\u0448\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0431\u0443\u0444\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0417\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0434\u0440\u044f\u0434<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u041f\u0440\u0438\u0440\u043e\u0441\u0442, \u041a\u0411<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0423\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c \u0431\u044b\u043b\u043e \u0431\u044b, \u041a\u0411<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u043e, \u0411<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">64<\/p>\n<\/td>\n<td>\n<p align=\"left\">128<\/p>\n<\/td>\n<td>\n<p align=\"left\">8 192<\/p>\n<\/td>\n<td>\n<p align=\"left\">139 296<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u0422\u0435 \u0436\u0435 64 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443. \u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445<\/em><\/p>\n<p>\u041f\u0443\u043b\u0443 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 \u0432\u0441\u0435 64 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u2014 139 296 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442. \u041c\u0430\u0441\u0441\u0438\u0432 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432 \u043a\u0443\u0447\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043d\u043e \u043e\u043d \u0442\u0430\u043c \u043e\u0434\u0438\u043d. \u041e\u0442\u0441\u044e\u0434\u0430 \u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0430: 128 \u041a\u0411 \u043f\u0440\u043e\u0442\u0438\u0432 8 192 \u041a\u0411.<\/p>\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u044f 2. Stream.CopyTo<\/h2>\n<p>81 920 \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.io.stream.copyto\" rel=\"noopener noreferrer nofollow\">Stream.CopyTo<\/a>. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0432\u044b\u0431\u0438\u0440\u0430\u043b\u0438 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0431\u0443\u0444\u0435\u0440 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b \u0432 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0438\u0437 <a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/Stream.cs\" rel=\"noopener noreferrer nofollow\">Stream.cs<\/a>:<\/p>\n<pre><code class=\"cs\">\/\/ dotnet\/runtime, System\/IO\/Stream.csprivate int GetCopyBufferSize(){    \/\/ This value was originally picked to be the largest multiple of 4096 that is still smaller than the large object heap threshold (85K).    \/\/ The CopyTo{Async} buffer is short-lived and is likely to be collected at Gen0, and it offers a significant improvement in Copy    \/\/ performance.  Since then, the base implementations of CopyTo{Async} have been updated to use ArrayPool, which will end up rounding    \/\/ this size up to the next power of two (131,072), which will by default be on the large object heap.  However, most of the time    \/\/ the buffer should be pooled, the LOH threshold is now configurable and thus may be different than 85K, and there are measurable    \/\/ benefits to using the larger buffer size.  So, for now, this value remains.    const int DefaultCopyBufferSize = 81920;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435, \u0432\u043d\u0443\u0442\u0440\u0438 <code>CopyToAsync<\/code>:<\/p>\n<pre><code class=\"cs\">\/\/ dotnet\/runtime, System\/IO\/Stream.csbyte[] buffer = ArrayPool&lt;byte&gt;.Shared.Rent(bufferSize);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430 \u043f\u0440\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0435\u0442. \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443: \u0431\u0443\u0444\u0435\u0440 \u0436\u0438\u0432\u0451\u0442 \u043d\u0435\u0434\u043e\u043b\u0433\u043e, \u043f\u043e\u0440\u043e\u0433 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/43179\" rel=\"noopener noreferrer nofollow\">dotnet\/runtime issue #43179<\/a> \u0437\u0430\u043a\u0440\u044b\u0442\u043e 25 \u0430\u043f\u0440\u0435\u043b\u044f 2025 \u0433\u043e\u0434\u0430. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u0435\u0436\u043d\u0435\u0439, \u0430\u0440\u0435\u043d\u0434\u0430 \u0438\u0437 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0443\u043b\u0430 \u0442\u043e\u0436\u0435 \u2014 \u043e\u0431\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u044b\u0448\u0435 \u0441\u043d\u044f\u0442\u044b \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e <code>Stream.cs<\/code>.<\/p>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u043e \u0434\u0432\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443: \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0431\u0430\u0439\u0442. \u041f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0435\u0451 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043b\u0438.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0427\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21161<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21162<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21163<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21164<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u043e, \u0411<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">MemoryStream \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">8 200<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a MemoryStream<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">128<\/p>\n<\/td>\n<td>\n<p align=\"left\">128<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">139 296<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u043e\u043d \u0436\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437 \u0432 \u0442\u043e\u043c \u0436\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 944 \u043d\u0430 \u21162 \u0438 \u21163, 138 768 \u043d\u0430 \u21161 \u0438 \u21164<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a, CopyTo(dest, 65 536)<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">74 688<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a, CopyToAsync(dest)<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">128<\/p>\n<\/td>\n<td>\n<p align=\"left\">128<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">139 296<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">FileStream, CopyTo(dest)<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">128<\/p>\n<\/td>\n<td>\n<p align=\"left\">128<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">139 296<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u041f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u041a\u0411 \u043f\u043e \u043c\u0430\u0448\u0438\u043d\u0430\u043c \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0431\u0430\u0439\u0442. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043d\u044f\u0442\u0430 \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c. \u0421\u0447\u0451\u0442\u0447\u0438\u043a \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u0435\u0442 \u0434\u043e 8 \u041a\u0411, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 8 200, \u0430 \u043d\u0435 300<\/em><\/p>\n<p>\u0418\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>MemoryStream \u0431\u0443\u0444\u0435\u0440 \u043d\u0435 \u0430\u0440\u0435\u043d\u0434\u0443\u0435\u0442: 8 200 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442, \u044d\u0442\u043e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a MemoryStream \u0430\u0440\u0435\u043d\u0434\u0443\u0435\u0442, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0430\u0439\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 139 296 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0442\u0440\u0451\u0445 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430\u0445 \u0438 \u0434\u0432\u0443\u0445 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430\u0445;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0437\u043c\u0435\u0440 65 536 \u0437\u0430\u0434\u0430\u043d \u044f\u0432\u043d\u043e, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e 74 688, \u0430\u0440\u0435\u043d\u0434\u043e\u0432\u0430\u043d \u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432;<\/p>\n<\/li>\n<li>\n<p>FileStream \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u0430\u044e\u0442 \u0442\u0435 \u0436\u0435 139\u00a0296;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0432\u0438\u0434\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0434\u0432\u0443\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0451\u0445.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u2014 \u0432 <a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/MemoryStream.cs\" rel=\"noopener noreferrer nofollow\">MemoryStream.cs<\/a>:<\/p>\n<pre><code class=\"cs\">\/\/ dotnet\/runtime, System\/IO\/MemoryStream.cspublic override void CopyTo(Stream destination, int bufferSize){    \/\/ If we have been inherited into a subclass, the following implementation could be incorrect    \/\/ since it does not call through to Read() which a subclass might have overridden.    \/\/ To be safe we will only use this implementation in cases where we know it is safe to do so,    \/\/ and delegate to our base class (which will call into Read) when we are not sure.    if (GetType() != typeof(MemoryStream))    {        base.CopyTo(destination, bufferSize);        return;    }    ...}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>MemoryStream<\/code> \u043e\u0442\u0434\u0430\u0451\u0442 \u0441\u0432\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043a\u043e\u0433\u0434\u0430 <code>GetType()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e <code>MemoryStream<\/code>. \u0423 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 <code>GetType()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430, \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u0430\u0451\u0442 <code>false<\/code>, \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0430 \u043e\u043d\u0430 \u0430\u0440\u0435\u043d\u0434\u0443\u0435\u0442 \u0431\u0443\u0444\u0435\u0440. <code>FileStream<\/code> \u0441\u0432\u043e\u0439 <code>CopyTo<\/code> \u043d\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u2014 \u043e\u0442\u0441\u044e\u0434\u0430 131 072 \u0431\u0430\u0439\u0442\u0430 \u043f\u0440\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u0432\u0435\u0437\u0434\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0440\u043e\u0441\u0442<\/strong><\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u0434\u0430\u0451\u0442 \u0442\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u0430 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u21162 \u0438 \u21163 \u0432\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 2 944 \u0431\u0430\u0439\u0442\u0430: \u0431\u0443\u0444\u0435\u0440 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u0443\u043b\u0435 \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041d\u0430 \u21161 \u0438 \u21164 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f 138 768 \u0431\u0430\u0439\u0442 \u2014 \u0431\u0443\u0444\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e. \u0412 \u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439, \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043f\u0443\u043b\u0435 \u0443\u0436\u0435 \u043d\u0435\u0442.<\/p>\n<p>\u041f\u0443\u043b \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f. \u041e \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 \u043e\u043d \u0443\u0437\u043d\u0430\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/Gen2GcCallback.cs\" rel=\"noopener noreferrer nofollow\"><code>Gen2GcCallback<\/code><\/a> \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u2014 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0443 <a href=\"https:\/\/habr.com\/ru\/articles\/723420\/\" rel=\"noopener noreferrer nofollow\">epeshk<\/a>. \u0417\u0430\u043c\u0435\u0440 \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u0443\u044e \u0441\u0431\u043e\u0440\u043a\u0443 \u0434\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e. \u041d\u0430 \u0447\u0430\u0441\u0442\u0438 \u043c\u0430\u0448\u0438\u043d \u043f\u0443\u043b \u0443\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0431\u0443\u0444\u0435\u0440 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0447\u0442\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u042d\u0442\u043e \u0432\u0438\u0434\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043e\u0442\u0447\u0451\u0442\u0435 \u0442\u043e\u0433\u043e \u0436\u0435 \u043f\u0440\u043e\u0433\u043e\u043d\u0430:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0427\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21161<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21162<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21163<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21164<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432\u0435\u0440\u043d\u0443\u043b\u043e\u0441\u044c \u0438\u0437 32 \u0431\u0435\u0437 \u0441\u0431\u043e\u0440\u043a\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432\u0435\u0440\u043d\u0443\u043b\u043e\u0441\u044c \u0438\u0437 32 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u043d\u043e\u0439   \u0441\u0431\u043e\u0440\u043a\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">31<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\">31<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u041e\u0442\u0447\u0451\u0442 reports. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u043d\u0430 \u0442\u0435\u0445 \u0434\u0432\u0443\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0433\u0434\u0435 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432\u044b\u0448\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0439<\/em><\/p>\n<p>\u0414\u0432\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 \u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u0438\u0445 \u0438 \u0442\u0435\u0445 \u0436\u0435 \u043c\u0430\u0448\u0438\u043d\u0430\u0445. \u0412 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0435\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u0435 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0431\u044b\u043b 128 \u041a\u0411, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u043e \u043d\u0435 \u0432 \u043c\u0430\u0448\u0438\u043d\u0435, \u0430 \u0432 \u0442\u043e\u043c, \u0434\u043e\u0448\u043b\u0430 \u043b\u0438 \u0434\u043e \u043f\u0443\u043b\u0430 \u0441\u0431\u043e\u0440\u043a\u0430. \u0410\u0440\u0435\u043d\u0434\u0430 131 072 \u0431\u0430\u0439\u0442 \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u0430\u0445 \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043d\u0438 \u043e\u0442 \u043c\u0430\u0448\u0438\u043d\u044b, \u043d\u0438 \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430.<\/p>\n<p><strong>\u0427\u0442\u043e \u0434\u0430\u0451\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0440\u043e\u0433\u0430<\/strong><\/p>\n<p>\u0412\u0442\u043e\u0440\u043e\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u2014 \u043f\u043e\u0440\u043e\u0433 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0422\u0435 \u0436\u0435 \u043e\u0442\u0447\u0451\u0442\u044b \u0441 <code>DOTNET_GCLOHThreshold=0x30000<\/code>, \u043f\u043e\u0440\u043e\u0433 196\u00a0608:<\/p>\n<pre><code class=\"cs\">\/\/ PoolProof, \u0432\u044b\u0432\u043e\u0434 \u043f\u0440\u0438 DOTNET_GCLOHThreshold=0x30000=== \u0413\u0434\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0440\u043e\u0433 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 ===\u043f\u043e\u0440\u043e\u0433 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: 85 000\u043f\u0435\u0440\u0432\u0430\u044f \u0434\u043b\u0438\u043d\u0430 byte[], \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0430\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435: 196 584\u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u043d\u0435\u0451: 262 144\u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u043b\u0438\u043d\u0430, \u043e\u0441\u0442\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438: 196 583<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>196 584 + 24 = 196 608. \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0432 24 \u0431\u0430\u0439\u0442\u0430 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b\u0441\u044f \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0440\u043e\u0433\u0435. <code>FileStream.CopyTo<\/code> \u0434\u0430\u0451\u0442 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043d\u0430 \u0432\u0441\u0435\u0445 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, 64 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u0442\u043e\u0436\u0435 \u0434\u0430\u044e\u0442 \u043d\u043e\u043b\u044c \u0432\u043c\u0435\u0441\u0442\u043e 128 \u041a\u0411. \u0411\u0443\u0444\u0435\u0440 \u043d\u0430 131 072 \u0432 \u044d\u0442\u0443 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442.<\/p>\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u044f 3. \u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0432 \u043f\u0443\u043b<\/h2>\n<p>\u0423 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.buffers.arraypool-1.return\" rel=\"noopener noreferrer nofollow\">Return<\/a> \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d, \u0430 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043a \u043c\u0435\u0442\u043e\u0434\u0443 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0440\u043e\u0432\u043d\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437:<\/p>\n<pre><code class=\"cs\">\/\/ dotnet\/runtime, System\/Buffers\/ArrayPool.cs\/\/\/ Once a buffer has been returned to the pool, the caller gives up all ownership of the buffer\/\/\/ and must not use it. The reference returned from a given call to &lt;see cref=\"Rent\"\/&gt; must only be\/\/\/ returned via &lt;see cref=\"Return\"\/&gt; once.  The default &lt;see cref=\"ArrayPool{T}\"\/&gt;\/\/\/ may hold onto the returned buffer in order to rent it again, or it may release the returned buffer\/\/\/ if it's determined that the pool already has enough buffers stored.public abstract void Return(T[] array, bool clearArray = false);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0427\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0431\u0430\u0439\u0442 \u043e\u0442 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0430\u0440\u0435\u043d\u0434\u0430\u0442\u043e\u0440\u0430 \u0438\u0437 16 \u043f\u043e\u0441\u043b\u0435   \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0431\u0435\u0437 \u043e\u0447\u0438\u0441\u0442\u043a\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">16<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0436\u0438\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 64 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0441\u0441\u044b\u043b\u043e\u043a   \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0431\u0435\u0437 \u043e\u0447\u0438\u0441\u0442\u043a\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">64<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0436\u0438\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438\u0437 64 \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0441   \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0434\u0432\u0435 \u0430\u0440\u0435\u043d\u0434\u044b \u043f\u043e\u0441\u043b\u0435 \u0434\u0432\u043e\u0439\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430   \u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043c\u0430\u0441\u0441\u0438\u0432<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0443\u043b\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">ArgumentException<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u041e\u0442\u0447\u0451\u0442\u044b reports \u0438 extra, \u0447\u0435\u0442\u044b\u0440\u0435 \u043c\u0430\u0448\u0438\u043d\u044b, \u0442\u0440\u0438 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430, \u043e\u0431\u0430 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430<\/em><\/p>\n<p>\u0418\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442 \u043e\u0442\u0434\u0430\u0451\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0430\u0440\u0435\u043d\u0434\u0430\u0442\u043e\u0440\u0443 \u0432\u0441\u0435 16 \u0431\u0430\u0439\u0442 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0441\u044b\u043b\u043e\u043a \u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 64 \u043e\u0431\u044a\u0435\u043a\u0442\u0430: \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u0438\u0445 \u043d\u0435 \u0437\u0430\u0431\u0435\u0440\u0451\u0442, \u043f\u043e\u043a\u0430 \u043a\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u044f\u0447\u0435\u0439\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442 \u044f\u0447\u0435\u0439\u043a\u0438, \u0438 \u0432\u0441\u0435 64 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0443\u0445\u043e\u0434\u044f\u0442 \u0432 \u0441\u0431\u043e\u0440\u043a\u0443;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0443\u043b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043a\u0438, \u0438 \u0434\u0432\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0430\u0440\u0435\u043d\u0434\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043e\u0434\u0438\u043d \u043c\u0430\u0441\u0441\u0438\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0440\u0430\u0441\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c \u0432\u044b\u0448\u0435: \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435\u0442. \u0414\u0432\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043a\u0430 \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043e\u0434\u0438\u043d \u0431\u0443\u0444\u0435\u0440 \u0438 \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u043e\u0431 \u044d\u0442\u043e\u043c. <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.buffers.arraypool-1.return\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u0430 <code>Return<\/code><\/a> \u043e\u0442\u043d\u043e\u0441\u0438\u0442 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043a \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044f\u043c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 CWE-415 \u0438 CWE-416 \u2014 \u0434\u0432\u043e\u0439\u043d\u043e\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043d\u0435\u0439 \u043f\u043e\u0441\u043b\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f. \u041c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0443\u043b\u0430 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c: \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432 \u043f\u0443\u043b\u0435 \u0435\u0441\u0442\u044c, \u043d\u043e \u043d\u0435 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439.<\/p>\n<p>\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f, \u0438 \u043e\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0434\u043b\u0438\u043d\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430:<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/43f\/8f2\/b69\/43f8f2b694f2cfc6401b44682410be40.png\" alt=\"\u0412\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0431\u0435\u0437 \u043d\u0435\u0451, .NET 10, \u043a\u043e\u043b\u043e\u043d\u043a\u0430 Ratio \u0438\u0437 \u043e\u0442\u0447\u0451\u0442\u0430 PoolClearBench. \u0428\u043a\u0430\u043b\u0430 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f\" title=\"\u0412\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0431\u0435\u0437 \u043d\u0435\u0451, .NET 10, \u043a\u043e\u043b\u043e\u043d\u043a\u0430 Ratio \u0438\u0437 \u043e\u0442\u0447\u0451\u0442\u0430 PoolClearBench. \u0428\u043a\u0430\u043b\u0430 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f\" width=\"1320\" height=\"675\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/43f\/8f2\/b69\/43f8f2b694f2cfc6401b44682410be40.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/43f\/8f2\/b69\/43f8f2b694f2cfc6401b44682410be40.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0412\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0431\u0435\u0437 \u043d\u0435\u0451, .NET 10, \u043a\u043e\u043b\u043e\u043d\u043a\u0430 Ratio \u0438\u0437 \u043e\u0442\u0447\u0451\u0442\u0430 <\/em><code><em>PoolClearBench<\/em><\/code><em>. \u0428\u043a\u0430\u043b\u0430 \u043b\u043e\u0433\u0430\u0440\u0438\u0444\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430 1 024 \u0431\u0430\u0439\u0442\u0430\u0445 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b: 1,56\u20131,65;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 16 384 \u0431\u0430\u0439\u0442\u0430\u0445 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e 9,51\u201314,46;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 81 920 \u0431\u0430\u0439\u0442\u0430\u0445 \u2014 95,20\u2013221,24;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0435 \u2014 1 014,69\u20133 002,97.<\/p>\n<\/li>\n<\/ul>\n<p>\u0410\u0440\u0435\u043d\u0434\u0430 \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u0431\u0435\u0437 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 8,0\u201313,7 \u043d\u0441 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u043e\u0442 1 024 \u0431\u0430\u0439\u0442 \u0434\u043e \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0430. \u041f\u0443\u043b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442, \u043e\u043d \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443. \u0412\u0441\u0451, \u0447\u0442\u043e \u0432\u044b\u0448\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435, \u2014 \u044d\u0442\u043e \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u0435.<\/p>\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u044f 4. \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0430\u0440\u0435\u043d\u0434\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/h2>\n<p>\u0417\u0430\u043c\u0435\u0440 \u043f\u0438\u0448\u0435\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u0438\u043d\u0430\u0447\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u043c. <code>new<\/code> \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e \u0432\u0441\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c, \u0430 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.gc.allocateuninitializedarray\" rel=\"noopener noreferrer nofollow\"><code>GC.AllocateUninitializedArray<\/code><\/a> \u043a \u043d\u0438\u043c \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c. \u0417\u0430\u043f\u0438\u0441\u044c \u0443\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0442\u0440\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430.<\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \u2014 \u043d\u0438\u0436\u043d\u044f\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430. \u041c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e\u0437\u0434\u0430\u043d \u0438 \u0443\u0436\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d, \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0427\u0442\u043e \u043c\u0435\u0440\u044f\u0435\u043c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21161 Ryzen<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21162 i9<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21163 Xeon Silver<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21164 Xeon W<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u043c\u0430\u0441\u0441\u0438\u0432 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c, 81 920<\/p>\n<\/td>\n<td>\n<p align=\"left\">803<\/p>\n<\/td>\n<td>\n<p align=\"left\">1 341<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 544<\/p>\n<\/td>\n<td>\n<p align=\"left\">1 601<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">new + \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 351<\/p>\n<\/td>\n<td>\n<p align=\"left\">3 858<\/p>\n<\/td>\n<td>\n<p align=\"left\">6 431<\/p>\n<\/td>\n<td>\n<p align=\"left\">7 471<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0431\u0435\u0437 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f + \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"left\">1 535<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 439<\/p>\n<\/td>\n<td>\n<p align=\"left\">4 407<\/p>\n<\/td>\n<td>\n<p align=\"left\">3 762<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0438\u0437 \u043f\u0443\u043b\u0430 + \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"left\">814<\/p>\n<\/td>\n<td>\n<p align=\"left\">1 346<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 584<\/p>\n<\/td>\n<td>\n<p align=\"left\">1 609<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u043c\u0430\u0441\u0441\u0438\u0432 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c, 1 \u041c\u0411<\/p>\n<\/td>\n<td>\n<p align=\"left\">11 802<\/p>\n<\/td>\n<td>\n<p align=\"left\">24 753<\/p>\n<\/td>\n<td>\n<p align=\"left\">32 775<\/p>\n<\/td>\n<td>\n<p align=\"left\">21 169<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">new + \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"left\">284 999<\/p>\n<\/td>\n<td>\n<p align=\"left\">86 904<\/p>\n<\/td>\n<td>\n<p align=\"left\">144 645<\/p>\n<\/td>\n<td>\n<p align=\"left\">148 997<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0431\u0435\u0437 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f + \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"left\">273 621<\/p>\n<\/td>\n<td>\n<p align=\"left\">68 416<\/p>\n<\/td>\n<td>\n<p align=\"left\">138 113<\/p>\n<\/td>\n<td>\n<p align=\"left\">109 088<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0438\u0437 \u043f\u0443\u043b\u0430 + \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"left\">12 035<\/p>\n<\/td>\n<td>\n<p align=\"left\">24 758<\/p>\n<\/td>\n<td>\n<p align=\"left\">32 279<\/p>\n<\/td>\n<td>\n<p align=\"left\">21 558<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u041d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0430 \u0432\u044b\u0437\u043e\u0432, .NET 10, \u043e\u0442\u0447\u0451\u0442 <\/em><code><em>PoolTouchBench<\/em><\/code><em>. \u0423 \u0441\u0442\u0440\u043e\u043a <\/em><code><em>new<\/em><\/code><em> \u0438 \u0431\u0435\u0437 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0440\u043e\u0441 \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e 5% \u043f\u0440\u043e\u0442\u0438\u0432 0,4% \u0443 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445, \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0433\u043e\u043d\u0430\u043c\u0438 \u044d\u0442\u0438 \u0447\u0438\u0441\u043b\u0430 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0440\u0430\u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f. \u0421\u0442\u0440\u043e\u043a\u0438 \u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0438 \u0438\u0437 \u043f\u0443\u043b\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u043a \u043f\u0440\u043e\u0433\u043e\u043d\u0443<\/em><\/p>\n<p>\u0418\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430 81 920 \u0431\u0430\u0439\u0442\u0430\u0445 \u0430\u0440\u0435\u043d\u0434\u0430 \u0438\u0434\u0451\u0442 \u043f\u043e \u043d\u0438\u0436\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435: 814 \u043f\u0440\u043e\u0442\u0438\u0432 803 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 1 609 \u043f\u0440\u043e\u0442\u0438\u0432 1 601 \u043d\u0430 \u0447\u0435\u0442\u0432\u0451\u0440\u0442\u043e\u0439;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0442\u043e \u0436\u0435: 12 035 \u043f\u0440\u043e\u0442\u0438\u0432 11 802 \u0438 21 558 \u043f\u0440\u043e\u0442\u0438\u0432 21\u00a0169;<\/p>\n<\/li>\n<li>\n<p>new \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0438 \u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u043d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0430\u0440\u0435\u043d\u0434\u044b \u043a \u043d\u0438\u0436\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u043e \u0432\u043e\u0441\u044c\u043c\u0438 \u0437\u0430\u043c\u0435\u0440\u0430\u043c \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432 \u043b\u0435\u0436\u0438\u0442 \u043c\u0435\u0436\u0434\u0443 0,985 \u0438 1,035. \u041f\u0443\u043b \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0432\u0435\u0440\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432. \u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 <code>new<\/code> \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0438\u0441\u044f\u0442 \u043e\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u0430\u0448\u0438\u043d\u044b, \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u2014 \u043d\u0435\u0442.<\/p>\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u044f 5. \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0443\u043b<\/h2>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441\u043d\u044f\u0442\u044b \u0442\u0430\u043a: \u0431\u0443\u0444\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443. \u0423\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0430\u0441 \u043f\u0443\u043b\u0430, \u0438 \u0430\u0440\u0435\u043d\u0434\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438. \u0417\u0430\u043c\u0435\u0440 \u0431\u0435\u0440\u0451\u0442 \u043e\u0434\u0438\u043d \u0440\u0430\u0437\u043c\u0435\u0440 \u0438 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0431\u0443\u0444\u0435\u0440\u044b \u0440\u0430\u0437\u043e\u043c, \u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u043e\u043d\u043a\u0430 Allocated.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0423\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0443\u0444\u0435\u0440\u043e\u0432<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21161, 32 \u043f\u0440\u043e\u0446.<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21162, 20 \u043f\u0440\u043e\u0446.<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21163, 64 \u043f\u0440\u043e\u0446.<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u21164, 20 \u043f\u0440\u043e\u0446.<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">512 \u043f\u043e 1 024 \u0431\u0430\u0439\u0442\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">1 024 \u043f\u043e 1 024 \u0431\u0430\u0439\u0442\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">401 384<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">401 385<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">512 \u043f\u043e 81 920 \u0431\u0430\u0439\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">8<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">1 024 \u043f\u043e 81 920 \u0431\u0430\u0439\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">32<\/p>\n<\/td>\n<td>\n<p align=\"left\">50 209 365<\/p>\n<\/td>\n<td>\n<p align=\"left\">0<\/p>\n<\/td>\n<td>\n<p align=\"left\">50 209 383<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0431\u0430\u0439\u0442 \u043d\u0430 \u0432\u044b\u0437\u043e\u0432, .NET 10, \u043e\u0442\u0447\u0451\u0442 PoolCapacityBench. \u0412 \u0448\u0430\u043f\u043a\u0435 \u043f\u043e\u0441\u043b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043c\u0430\u0448\u0438\u043d\u044b \u2014 \u0447\u0438\u0441\u043b\u043e \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/em><\/p>\n<p>\u0418\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u043d\u0430 512 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u0430\u0445 \u0432\u0441\u0435 \u0447\u0435\u0442\u044b\u0440\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442 \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 32 \u0431\u0430\u0439\u0442;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0430\u0448\u0438\u043d\u044b \u0441 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 \u043d\u0430 1 024 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u0430\u0445 \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442 401 \u041a\u0411 \u043f\u0440\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 1 024 \u0431\u0430\u0439\u0442\u0430 \u0438 50 \u041c\u0411 \u043f\u0440\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 81\u00a0920;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0430\u0448\u0438\u043d\u044b \u0441 32 \u0438 64 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 \u043d\u0430 \u0442\u0435\u0445 \u0436\u0435 1 024 \u0431\u0443\u0444\u0435\u0440\u0430\u0445 \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442 32 \u0431\u0430\u0439\u0442\u0430 \u0438 \u043d\u043e\u043b\u044c.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u0434\u0432\u0435 \u043f\u0430\u0440\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432. \u041e\u0431\u0449\u0438\u0439 \u043f\u0443\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 \u0441\u0442\u0435\u043a\u0430\u0445, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c, \u0438 \u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u0442\u0451\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c. \u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u043e \u0443 <a href=\"https:\/\/habr.com\/ru\/articles\/723420\/\" rel=\"noopener noreferrer nofollow\">epeshk<\/a>, \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u2014 <a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/Buffers\/SharedArrayPool.cs\" rel=\"noopener noreferrer nofollow\">SharedArrayPool.cs<\/a>.<\/p>\n<p>\u041e\u0442\u0441\u044e\u0434\u0430 \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435: \u0437\u0430\u043c\u0435\u0440 \u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u0434\u043e \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0443\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u044b. \u041e\u0431\u0449\u0438\u0439 \u043f\u0443\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u0432\u0441\u0451, \u0447\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u043e\u0441\u044c, \u0434\u043e 134 217 728 \u0431\u0430\u0439\u0442. \u041f\u0443\u043b \u0438\u0437 <code>ArrayPool.Create<\/code> \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 \u0434\u043e 1 048 576 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e:<\/p>\n<pre><code class=\"cs\">\/\/ PoolProof, \u0432\u044b\u0432\u043e\u0434 dotnet run -c Release -f net10.0 -- extra=== \u0414\u043e \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043f\u0443\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u044b ===        \u0420\u0430\u0437\u043c\u0435\u0440    Shared    Create()       524 288    \u0445\u0440\u0430\u043d\u0438\u0442      \u0445\u0440\u0430\u043d\u0438\u0442     1 048 576    \u0445\u0440\u0430\u043d\u0438\u0442      \u0445\u0440\u0430\u043d\u0438\u0442     2 097 152    \u0445\u0440\u0430\u043d\u0438\u0442         \u043d\u0435\u0442     4 194 304    \u0445\u0440\u0430\u043d\u0438\u0442         \u043d\u0435\u0442<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p><strong>\u041f\u043e \u0446\u0438\u0444\u0440\u0430\u043c:<\/strong><\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u0440\u043e\u0433 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043b\u044f byte[] \u2014 84 976 \u0431\u0430\u0439\u0442, \u0430 \u043d\u0435 85 000: \u043a \u0434\u043b\u0438\u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0432 24 \u0431\u0430\u0439\u0442\u0430. \u041f\u0440\u0438 \u043f\u043e\u0434\u043d\u044f\u0442\u043e\u043c \u043f\u043e\u0440\u043e\u0433\u0435 196 608 \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e 196 584, \u0442\u0435 \u0436\u0435 24 \u0431\u0430\u0439\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0430\u0440\u0435\u043d\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u044d\u0442\u0443 \u043a\u0443\u0447\u0443 \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u043e\u0442 65 537 \u0434\u043e 84 975 \u0431\u0430\u0439\u0442, new \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p>64 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u043e 81 920 \u0431\u0430\u0439\u0442, \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0434\u0430\u044e\u0442 8 195 \u041a\u0411; \u0442\u0435 \u0436\u0435 64 \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u2014 128 \u041a\u0411 \u0438 139 296 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442;<\/p>\n<\/li>\n<li>\n<p><code>new<\/code> \u043d\u0430 81 920 \u0431\u0430\u0439\u0442 \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u044d\u0442\u0443 \u043a\u0443\u0447\u0443 \u043d\u0438 \u043f\u0440\u0438 \u043a\u0430\u043a\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0443\u0444\u0435\u0440\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p><code>FileStream.CopyTo<\/code>, <code>CopyToAsync<\/code> \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0438 <code>MemoryStream<\/code> \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442 139 296 \u0431\u0430\u0439\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u0430 \u0441\u0430\u043c <code>MemoryStream<\/code> \u043d\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0432\u0438\u0434\u0435\u043d \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430: \u043f\u0443\u043b \u0447\u0435\u0440\u0435\u0437 <code>Gen2GcCallback<\/code> \u043e\u0442\u0434\u0430\u0451\u0442 \u0431\u0443\u0444\u0435\u0440 \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f, \u0438 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u043c\u0430\u0448\u0438\u043d \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u043e \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0442\u043e \u0436\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438 <code>DOTNET_GCLOHThreshold=0x30000<\/code> \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u043a\u0443\u0447\u0438 \u043d\u0435 \u0434\u0430\u0451\u0442;<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0431\u0435\u0437 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043e\u0442\u0434\u0430\u0451\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0430\u0440\u0435\u043d\u0434\u0430\u0442\u043e\u0440\u0443 \u0432\u0441\u0435 16 \u0431\u0430\u0439\u0442 \u0438 \u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 64 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u043d\u0435 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430; \u043f\u0443\u043b \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0443\u043b\u0430, \u0430 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0431\u0435\u0437 \u043d\u0435\u0451 \u0432 1,56\u20131,65 \u0440\u0430\u0437\u0430 \u043d\u0430 1 024 \u0431\u0430\u0439\u0442\u0430\u0445 \u0438 \u0432 1 014,69\u20133 002,97 \u0440\u0430\u0437\u0430 \u043d\u0430 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0435; \u0430\u0440\u0435\u043d\u0434\u0430 \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 8,0\u201313,7 \u043d\u0441 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0430\u0440\u0435\u043d\u0434\u0430 \u0438\u0434\u0451\u0442 \u043f\u043e \u043d\u0438\u0436\u043d\u0435\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435: \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 0,985\u20131,035 \u043f\u043e \u0432\u043e\u0441\u044c\u043c\u0438 \u0437\u0430\u043c\u0435\u0440\u0430\u043c \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0430\u0448\u0438\u043d\u044b \u0441 20 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 \u043d\u0430 1 024 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0431\u0443\u0444\u0435\u0440\u0430\u0445 \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442 401 \u041a\u0411 \u043f\u0440\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 1 024 \u0431\u0430\u0439\u0442\u0430 \u0438 50 \u041c\u0411 \u043f\u0440\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0435 81 920, \u043c\u0430\u0448\u0438\u043d\u044b \u0441 32 \u0438 64 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 \u2014 32 \u0431\u0430\u0439\u0442\u0430 \u0438 \u043d\u043e\u043b\u044c;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u0439 \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043e\u0432\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 \u043e\u0442 65 537 \u0434\u043e 84 975 \u0431\u0430\u0439\u0442 \u0447\u0435\u0440\u0435\u0437 <code>new<\/code>: \u0430\u0440\u0435\u043d\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, <code>new<\/code> \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p>\u044f\u0432\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u0440\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0432\u043d\u0435 \u044d\u0442\u043e\u0439 \u043a\u0443\u0447\u0438: CopyTo(dest, 65 536);<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u043e\u0440\u043e\u0433 \u0447\u0435\u0440\u0435\u0437 DOTNET_GCLOHThreshold, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f: \u043d\u0430 \u0437\u0430\u043c\u0435\u0440\u0430\u0445 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442;<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0431\u0443\u0444\u0435\u0440 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b: \u0432 \u043a\u0443\u0447\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0430 \u0432\u044b\u0437\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0441\u044b\u043b\u043e\u043a \u0438 \u0431\u0443\u0444\u0435\u0440\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0430\u0440\u0435\u043d\u0434\u0430\u0442\u043e\u0440\u0443: \u0431\u0435\u0437 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043f\u0443\u043b \u043d\u0435 \u0434\u0430\u0451\u0442 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0443 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0430 \u043d\u0430 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0435 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0432 \u0442\u044b\u0441\u044f\u0447\u0443 \u0441 \u043b\u0438\u0448\u043d\u0438\u043c \u0440\u0430\u0437 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043d\u0435\u043c\u0443 \u043f\u043e\u0441\u043b\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430: \u043f\u0443\u043b \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043d\u0435 \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0435\u0442;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u0440 \u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438 \u0441 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440: \u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u043c\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0439\u0442\u0430\u043c\u0438: \u0441\u0431\u043e\u0440\u043a\u0430 \u043c\u0443\u0441\u043e\u0440\u0430 \u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0440\u0438\u0440\u043e\u0441\u0442, \u043d\u043e \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0430\u0439\u0442\u044b.<\/p>\n<\/li>\n<\/ul>\n<h2>\u041a\u043e\u0434 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/ComboxSoftDeveloper\/PoolProof\" rel=\"noopener noreferrer nofollow\">PoolProof<\/a> \u2014 \u0437\u0430\u043c\u0435\u0440\u044b, \u043e\u0442\u0447\u0451\u0442\u044b \u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u044b \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445<\/p>\n<\/li>\n<\/ul>\n<h2>\u0421\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/articles\/723420\/\" rel=\"noopener noreferrer nofollow\">ArrayPool&lt;T&gt;: \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.buffers.arraypool-1\" rel=\"noopener noreferrer nofollow\">ArrayPool&lt;T&gt;<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.buffers.arraypool-1.return\" rel=\"noopener noreferrer nofollow\">ArrayPool&lt;T&gt;.Return<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/Buffers\/ArrayPool.cs\" rel=\"noopener noreferrer nofollow\">ArrayPool.cs \u2014 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043a Return<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/Buffers\/Utilities.cs\" rel=\"noopener noreferrer nofollow\">Utilities.cs \u2014 \u0440\u0430\u0441\u0447\u0451\u0442 \u0431\u0430\u043a\u0435\u0442\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/Buffers\/SharedArrayPool.cs\" rel=\"noopener noreferrer nofollow\">SharedArrayPool.cs \u2014 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/Gen2GcCallback.cs\" rel=\"noopener noreferrer nofollow\">Gen2GcCallback.cs \u2014 \u043a\u0430\u043a \u043f\u0443\u043b \u0443\u0437\u043d\u0430\u0451\u0442 \u043e \u0441\u0431\u043e\u0440\u043a\u0435<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/learn.microsoft.com\/dotnet\/standard\/garbage-collection\/large-object-heap\" rel=\"noopener noreferrer nofollow\">\u041a\u0443\u0447\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/runtime-config\/garbage-collector\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430 \u043c\u0443\u0441\u043e\u0440\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.io.stream.copyto\" rel=\"noopener noreferrer nofollow\">Stream.CopyTo<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/Stream.cs\" rel=\"noopener noreferrer nofollow\">Stream.cs \u2014 \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u0438 \u0430\u0440\u0435\u043d\u0434\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/MemoryStream.cs\" rel=\"noopener noreferrer nofollow\">MemoryStream.cs \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 GetType \u0432 CopyTo<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.gc.allocateuninitializedarray\" rel=\"noopener noreferrer nofollow\">GC.AllocateUninitializedArray<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/43179\" rel=\"noopener noreferrer nofollow\">issue #43179 \u2014 \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430 CopyTo \u0438 \u044d\u0442\u043e\u0439 \u043a\u0443\u0447\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/BenchmarkDotNet\" rel=\"noopener noreferrer nofollow\">BenchmarkDotNet<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0412\u0441\u0435\u043c \u0443\u0434\u0430\u0447\u0438 \u0438 \u0434\u043e \u043d\u043e\u0432\u044b\u0445 \u0432\u0441\u0442\u0440\u0435\u0447!<\/strong><\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1065518\/\">https:\/\/habr.com\/ru\/articles\/1065518\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0431\u0443\u0444\u0435\u0440\u043e\u043c \u043f\u0440\u0438 \u0430\u0440\u0435\u043d\u0434\u0435 \u0438\u0437 ArrayPool, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u044b\u0432\u043e\u0434\u044b.\u041f\u0443\u043b \u0431\u0435\u0440\u0443\u0442, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u044b\u0445. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u0440\u0443\u043f\u043d\u044b\u0435: \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0442 85 000 \u0431\u0430\u0439\u0442 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0430 \u043e\u043d\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435\u043c. \u041d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u041f\u0443\u043b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u044d\u0442\u0443 \u043a\u0443\u0447\u0443, \u0430 new \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438. \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0434\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 \u0431\u0443\u0444\u0435\u0440 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432.\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430 n \u0431\u0430\u0439\u0442:new byte[n] \u2014 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u043f\u0430\u043c\u044f\u0442\u044c \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u0442\u0441\u044f;GC.AllocateUninitializedArray&lt;byte&gt;(n) \u2014 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043e\u0431\u043d\u0443\u043b\u0435\u043d\u0438\u044f;ArrayPool&lt;byte&gt;.Shared.Rent(n) \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c Return \u2014 \u0430\u0440\u0435\u043d\u0434\u0430 \u0438\u0437 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0443\u043b\u0430.\u0411\u0443\u0434\u0435\u0442 5 \u0438\u0441\u0442\u043e\u0440\u0438\u0439:\u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u0443\u0444\u0435\u0440 \u043d\u0430 81 920 \u0431\u0430\u0439\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 131 072 \u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 LOH;\u0433\u0434\u0435 Stream.CopyTo \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 LOH, \u0430 \u0433\u0434\u0435 \u043d\u0435\u0442;\u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043f\u0443\u043b;\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u044b\u0434\u0430\u0447\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430;\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u043b \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438 \u043e\u0442 \u0447\u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e.\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043e\u0431\u043e\u0438\u0445 \u043f\u0443\u043b\u043e\u0432 \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u044b \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 epeshk \u00abArrayPool&lt;T&gt;: \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438\u00bb. \u0417\u0434\u0435\u0441\u044c \u0434\u0440\u0443\u0433\u043e\u0435: \u0442\u0435 \u0436\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u043d\u043e \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0437\u0430\u043c\u0435\u0440\u043e\u0432, \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u0438 \u0442\u0440\u0451\u0445 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430\u0445.\u041a\u043e\u0434 \u2014 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 PoolProof. \u0427\u0435\u0442\u044b\u0440\u0435 \u043c\u0430\u0448\u0438\u043d\u044b:\u2116CPU\u042f\u0434\u0440\u0430\/\u043f\u043e\u0442\u043e\u043a\u0438\u0427\u0430\u0441\u0442\u043e\u0442\u0430\u041e\u0421\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u0432.NET 10\u21161AMD Ryzen 9 5950X16 \/ 323,4 \u0413\u0413\u0446, \u0434\u043e 4,9 \u0432 \u0442\u0443\u0440\u0431\u043eWindows 10 18093210.0.5\u21162Intel Core i9-10900KF10 \/ 203,7 \u0413\u0413\u0446, \u0434\u043e 5,3 \u0432 \u0442\u0443\u0440\u0431\u043eWindows 10 22H22010.0.10\u211632 \u00d7 Intel Xeon Silver 43142\u00d716 \/ 642,4 \u0413\u0413\u0446, \u0434\u043e 3,4 \u0432 \u0442\u0443\u0440\u0431\u043eWindows Server 20226410.0.1\u21164Intel Xeon W-225510 \/ 203,7 \u0413\u0413\u0446, \u0434\u043e 4,5 \u0432 \u0442\u0443\u0440\u0431\u043eWindows Server 20222010.0.1BenchmarkDotNet 0.15.8, Release, .NET 8, 9 \u0438 10. \u041e\u0442\u0447\u0451\u0442\u044b \u0441\u043d\u044f\u0442\u044b \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0435 \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u043c, \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0432\u043f\u0430\u043b\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043b\u044c\u0448\u0435 \u0434\u0430\u043d\u044b \u0431\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041f\u0430\u0442\u0447-\u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430 \u2014 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0435.\u0418\u0441\u0442\u043e\u0440\u0438\u044f 1. \u041e\u0442\u043a\u0443\u0434\u0430 \u0431\u0435\u0440\u0451\u0442\u0441\u044f 131\u00a0072\u041f\u0443\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u043c\u0438 \u0434\u0432\u043e\u0439\u043a\u0438. \u041d\u043e\u043c\u0435\u0440 \u0431\u0430\u043a\u0435\u0442\u0430 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u2014 Utilities.cs:\/\/ dotnet\/runtime, System\/Buffers\/Utilities.cs[MethodImpl(MethodImplOptions.AggressiveInlining)]internal static int SelectBucketIndex(int bufferSize){    \/\/ Buffers are bucketed so that a request between 2^(n-1) + 1 and 2^n is given a buffer of 2^n    \/\/ Bucket index is log2(bufferSize &#8212; 1) with the exception that buffers between 1 and 16 bytes    \/\/ are combined, and the index is slid down by 3 to compensate.    \/\/ Zero is a valid bufferSize, and it is assigned the highest bucket index so that zero-length    \/\/ buffers are not retained by the pool. The pool will return the Array.Empty singleton for these.    return BitOperations.Log2((uint)bufferSize &#8212; 1 | 15) &#8212; 3;}\u0414\u043b\u044f 81 920 \u044d\u0442\u043e \u0431\u0430\u043a\u0435\u0442 13, \u0430 \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043d\u0451\u043c \u2014 131 072 \u0431\u0430\u0439\u0442\u0430. \u0421\u0442\u0440\u043e\u043a\u0430 16 &lt;&lt; 13 \u2014 \u044d\u0442\u043e 16 * 2\u00b9\u00b3: \u043f\u0443\u043b \u0445\u0440\u0430\u043d\u0438\u0442 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u0442\u0435\u043f\u0435\u043d\u044f\u043c\u0438 \u0434\u0432\u043e\u0439\u043a\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0438 \u0431\u0430\u0439\u0442, \u0438 \u043d\u043e\u043c\u0435\u0440 \u0431\u0430\u043a\u0435\u0442\u0430 \u0437\u0430\u0434\u0430\u0451\u0442 \u0441\u0442\u0435\u043f\u0435\u043d\u044c.\/\/ PoolProof, \u0432\u044b\u0432\u043e\u0434 dotnet run -c Release -f net10.0 &#8212; extra=== \u0413\u0434\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0440\u043e\u0433 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 ===\u043f\u043e\u0440\u043e\u0433 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: 85 000\u043f\u0435\u0440\u0432\u0430\u044f \u0434\u043b\u0438\u043d\u0430 byte[], \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0430\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435: 84 976\u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u043d\u0435\u0451: 131 072\u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u043b\u0438\u043d\u0430, \u043e\u0441\u0442\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438: 84 97584 976 + 24 = 85 000. \u0414\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0431\u0430\u0439\u0442\u0430 \u2014 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 x64: \u0441\u0438\u043d\u0445\u0440\u043e\u0431\u043b\u043e\u043a, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0442\u0438\u043f\u0430, \u0434\u043b\u0438\u043d\u0430. \u041a \u044d\u0442\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443 \u0432\u0435\u0440\u043d\u0443\u0441\u044c \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438: \u0435\u0441\u043b\u0438 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u043f\u043e\u0440\u043e\u0433, \u0442\u0435 \u0436\u0435 24 \u0431\u0430\u0439\u0442\u0430 \u043e\u0442\u043d\u0438\u043c\u0443\u0442\u0441\u044f \u043e\u0442 \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.\u0414\u043b\u044f \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u0432\u0443\u0445 \u0447\u0438\u0441\u0435\u043b. \u041d\u0430 \u043a\u0430\u043a\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u043f\u0443\u043b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 LOH, \u0445\u043e\u0442\u044f \u0431\u0435\u0437 \u043f\u0443\u043b\u0430 \u043e\u043d \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0431\u044b \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u0443\u0447\u0435:\u0417\u0430\u043f\u0440\u043e\u0441, \u0431\u0430\u0439\u0442\u0411\u0430\u043a\u0435\u0442\u0414\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0431\u0430\u0439\u0442\u0412 LOH\u0410 \u0431\u0435\u0437 \u043f\u0443\u043b\u043065 5361265 536\u043d\u0435\u0442\u043d\u0435\u044265 53713131 072\u0434\u0430\u043d\u0435\u044281 92013131 072\u0434\u0430\u043d\u0435\u044284 97513131 072\u0434\u0430\u043d\u0435\u044284 97613131 072\u0434\u0430\u0434\u0430\u0411\u0430\u043a\u0435\u0442 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043d \u043f\u043e SelectBucketIndex, \u043f\u043e\u0440\u043e\u0433 \u0434\u043b\u044f byte[] \u0432\u0437\u044f\u0442 \u0438\u0437 \u043e\u0442\u0447\u0451\u0442\u0430 extra\u041f\u0443\u043b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u043e\u0442 65 537 \u0434\u043e 84 975 \u0431\u0430\u0439\u0442. new \u043d\u0430 \u044d\u0442\u0438\u0445 \u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438. \u041d\u0438\u0436\u0435 65 537 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u0451\u0442 65 536 \u0438 \u0432 LOH \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442. \u0421 84 976 \u0431\u0430\u0439\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0434\u0451\u0442 \u0432 LOH \u0438 \u0431\u0435\u0437 \u043f\u0443\u043b\u0430. \u0411\u0443\u0444\u0435\u0440 CopyTo \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u044d\u0442\u043e\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d.\u0417\u0430\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0439: 16, 32 \u0438 64 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u043e 81 920 \u0431\u0430\u0439\u0442 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.\u041f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0431\u0443\u0444\u0435\u0440\u044b \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0442\u0440\u0451\u0445 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430\u0445 \u0438 \u043e\u0431\u043e\u0438\u0445 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430\u0445\u0418\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:16 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438\u0437 \u043f\u0443\u043b\u0430 \u0434\u0430\u044e\u0442 2 048 \u041a\u0411, \u0440\u043e\u0432\u043d\u043e \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043f\u043e 131 072 \u0431\u0430\u0439\u0442\u0430;32 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0430\u044e\u0442 4 097 \u041a\u0411 \u043f\u0440\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 4\u00a0096;64 \u0431\u0443\u0444\u0435\u0440\u0430 \u0434\u0430\u044e\u0442 8 195 \u041a\u0411 \u043f\u0440\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 8\u00a0192;new \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0434\u0430\u0451\u0442 \u043d\u043e\u043b\u044c: 81 920 \u0431\u0430\u0439\u0442 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0438.\u041a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043c\u0435\u0440 \u0438\u0434\u0451\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c. \u0418\u043d\u0430\u0447\u0435 32 \u0431\u0443\u0444\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0443\u0442\u0441\u044f \u0438\u0437 \u0442\u0435\u0445, \u0447\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u043b \u0432 \u043f\u0443\u043b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0437\u0430\u043c\u0435\u0440, \u0438 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0432\u0434\u0432\u043e\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e.\u0425\u0443\u0434\u0448\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0431\u0443\u0444\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443:\u0417\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e\u0434\u0440\u044f\u0434\u041f\u0440\u0438\u0440\u043e\u0441\u0442, \u041a\u0411\u0423\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c \u0431\u044b\u043b\u043e \u0431\u044b, \u041a\u0411\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u043e, \u0411641288 192139 296\u0422\u0435 \u0436\u0435 64 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443. \u041e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445\u041f\u0443\u043b\u0443 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 \u0432\u0441\u0435 64 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u2014 139 296 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442. \u041c\u0430\u0441\u0441\u0438\u0432 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432 \u043a\u0443\u0447\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043d\u043e \u043e\u043d \u0442\u0430\u043c \u043e\u0434\u0438\u043d. \u041e\u0442\u0441\u044e\u0434\u0430 \u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0430: 128 \u041a\u0411 \u043f\u0440\u043e\u0442\u0438\u0432 8 192 \u041a\u0411.\u0418\u0441\u0442\u043e\u0440\u0438\u044f 2. Stream.CopyTo81 920 \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443 Stream.CopyTo. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0432\u044b\u0431\u0438\u0440\u0430\u043b\u0438 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0431\u0443\u0444\u0435\u0440 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b \u0432 \u043a\u0443\u0447\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0438\u0437 Stream.cs:\/\/ dotnet\/runtime, System\/IO\/Stream.csprivate int GetCopyBufferSize(){    \/\/ This value was originally picked to be the largest multiple of 4096 that is still smaller than the large object heap threshold (85K).    \/\/ The CopyTo{Async} buffer is short-lived and is likely to be collected at Gen0, and it offers a significant improvement in Copy    \/\/ performance.  Since then, the base implementations of CopyTo{Async} have been updated to use ArrayPool, which will end up rounding    \/\/ this size up to the next power of two (131,072), which will by default be on the large object heap.  However, most of the time    \/\/ the buffer should be pooled, the LOH threshold is now configurable and thus may be different than 85K, and there are measurable    \/\/ benefits to using the larger buffer size.  So, for now, this value remains.    const int DefaultCopyBufferSize = 81920;\u0412 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435, \u0432\u043d\u0443\u0442\u0440\u0438 CopyToAsync:\/\/ dotnet\/runtime, System\/IO\/Stream.csbyte[] buffer = ArrayPool&lt;byte&gt;.Shared.Rent(bufferSize);\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430 \u043f\u0440\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0435\u0442. \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443: \u0431\u0443\u0444\u0435\u0440 \u0436\u0438\u0432\u0451\u0442 \u043d\u0435\u0434\u043e\u043b\u0433\u043e, \u043f\u043e\u0440\u043e\u0433 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0435\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435.\u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 dotnet\/runtime issue #43179 \u0437\u0430\u043a\u0440\u044b\u0442\u043e 25 \u0430\u043f\u0440\u0435\u043b\u044f 2025 \u0433\u043e\u0434\u0430. \u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u043f\u0440\u0435\u0436\u043d\u0435\u0439, \u0430\u0440\u0435\u043d\u0434\u0430 \u0438\u0437 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0443\u043b\u0430 \u0442\u043e\u0436\u0435 \u2014 \u043e\u0431\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u044b\u0448\u0435 \u0441\u043d\u044f\u0442\u044b \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e Stream.cs.\u0414\u0430\u043b\u044c\u0448\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u043e \u0434\u0432\u0435 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443: \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0431\u0430\u0439\u0442. \u041f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0435\u0451 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u043b\u0438.\u0427\u0442\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c\u21161\u21162\u21163\u21164\u0412\u044b\u0434\u0435\u043b\u0435\u043d\u043e, \u0411MemoryStream \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u043000008 200\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a MemoryStream01281280139 296\u043e\u043d \u0436\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437 \u0432 \u0442\u043e\u043c \u0436\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043500002 944 \u043d\u0430 \u21162 \u0438 \u21163, 138 768 \u043d\u0430 \u21161 \u0438 \u21164\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a, CopyTo(dest, 65 536)000074 688\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a, CopyToAsync(dest)01281280139 296FileStream, CopyTo(dest)01281280139 296\u041f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u041a\u0411 \u043f\u043e \u043c\u0430\u0448\u0438\u043d\u0430\u043c \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0431\u0430\u0439\u0442. \u041a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043d\u044f\u0442\u0430 \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c. \u0421\u0447\u0451\u0442\u0447\u0438\u043a \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u0435\u0442 \u0434\u043e 8 \u041a\u0411, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 8 200, \u0430 \u043d\u0435 300\u0418\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:MemoryStream \u0431\u0443\u0444\u0435\u0440 \u043d\u0435 \u0430\u0440\u0435\u043d\u0434\u0443\u0435\u0442: 8 200 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0430\u0439\u0442, \u044d\u0442\u043e \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430;\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a MemoryStream \u0430\u0440\u0435\u043d\u0434\u0443\u0435\u0442, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0430\u0439\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 139 296 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0442\u0440\u0451\u0445 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430\u0445 \u0438 \u0434\u0432\u0443\u0445 \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430\u0445;\u0440\u0430\u0437\u043c\u0435\u0440 65 536 \u0437\u0430\u0434\u0430\u043d \u044f\u0432\u043d\u043e, \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e 74 688, \u0430\u0440\u0435\u043d\u0434\u043e\u0432\u0430\u043d \u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432;FileStream \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u0430\u044e\u0442 \u0442\u0435 \u0436\u0435 139\u00a0296;\u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0432\u0438\u0434\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0434\u0432\u0443\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u0438\u0437 \u0447\u0435\u0442\u044b\u0440\u0451\u0445.\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u2014 \u0432 MemoryStream.cs:\/\/ dotnet\/runtime, System\/IO\/MemoryStream.cspublic override void CopyTo(Stream destination, int bufferSize){    \/\/ If we have been inherited into a subclass, the following implementation could be incorrect    \/\/ since it does not call through to Read() which a subclass might have overridden.    \/\/ To be safe we will only use this implementation in cases where we know it is safe to do so,    \/\/ and delegate to our base class (which will call into Read) when we are not sure.    if (GetType() != typeof(MemoryStream))    {        base.CopyTo(destination, bufferSize);        return;    }    &#8230;}MemoryStream \u043e\u0442\u0434\u0430\u0451\u0442 \u0441\u0432\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043a\u043e\u0433\u0434\u0430 GetType() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e MemoryStream. \u0423 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 GetType() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430, \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u0430\u0451\u0442 false, \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0430 \u043e\u043d\u0430 \u0430\u0440\u0435\u043d\u0434\u0443\u0435\u0442 \u0431\u0443\u0444\u0435\u0440. FileStream \u0441\u0432\u043e\u0439 CopyTo \u043d\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u2014 \u043e\u0442\u0441\u044e\u0434\u0430 131 072 \u0431\u0430\u0439\u0442\u0430 \u043f\u0440\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430.\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u0432\u0435\u0437\u0434\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u041e\u0442\u0432\u0435\u0442 \u0434\u0430\u0451\u0442 \u0442\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u0430 \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u21162 \u0438 \u21163 \u0432\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 2 944 \u0431\u0430\u0439\u0442\u0430: \u0431\u0443\u0444\u0435\u0440 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u0443\u043b\u0435 \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041d\u0430 \u21161 \u0438 \u21164 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f 138 768 \u0431\u0430\u0439\u0442 \u2014 \u0431\u0443\u0444\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e. \u0412 \u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439, \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432 \u043f\u0443\u043b\u0435 \u0443\u0436\u0435 \u043d\u0435\u0442.\u041f\u0443\u043b \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u044f. \u041e \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 \u043e\u043d \u0443\u0437\u043d\u0430\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 Gen2GcCallback \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u2014 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d \u0443 epeshk. \u0417\u0430\u043c\u0435\u0440 \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u0443\u044e \u0441\u0431\u043e\u0440\u043a\u0443 \u0434\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e. \u041d\u0430 \u0447\u0430\u0441\u0442\u0438 \u043c\u0430\u0448\u0438\u043d \u043f\u0443\u043b \u0443\u0441\u043f\u0435\u0432\u0430\u0435\u0442 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0431\u0443\u0444\u0435\u0440 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0447\u0442\u0435\u043d\u0438\u044f\u043c\u0438.\u042d\u0442\u043e \u0432\u0438\u0434\u043d\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043e\u0442\u0447\u0451\u0442\u0435 \u0442\u043e\u0433\u043e \u0436\u0435 \u043f\u0440\u043e\u0433\u043e\u043d\u0430:\u0427\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u21161\u21162\u21163\u21164\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432\u0435\u0440\u043d\u0443\u043b\u043e\u0441\u044c \u0438\u0437 32 \u0431\u0435\u0437 \u0441\u0431\u043e\u0440\u043a\u043832323232\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0432\u0435\u0440\u043d\u0443\u043b\u043e\u0441\u044c \u0438\u0437 32 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u043d\u043e\u0439   \u0441\u0431\u043e\u0440\u043a\u043831323231\u041e\u0442\u0447\u0451\u0442 reports. \u0415\u0434\u0438\u043d\u0438\u0446\u0430 \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u043d\u0430 \u0442\u0435\u0445 \u0434\u0432\u0443\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0433\u0434\u0435 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u043a\u0443\u0447\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432\u044b\u0448\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0439\u0414\u0432\u0430 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 \u0441\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u0438\u0445 \u0438 \u0442\u0435\u0445 \u0436\u0435 \u043c\u0430\u0448\u0438\u043d\u0430\u0445. \u0412 \u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u043d\u043d\u0435\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u0435 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0431\u044b\u043b 128 \u041a\u0411, \u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u043e \u043d\u0435 \u0432 \u043c\u0430\u0448\u0438\u043d\u0435, \u0430 \u0432 \u0442\u043e\u043c, \u0434\u043e\u0448\u043b\u0430 \u043b\u0438 \u0434\u043e \u043f\u0443\u043b\u0430 \u0441\u0431\u043e\u0440\u043a\u0430. \u0410\u0440\u0435\u043d\u0434\u0430 131 072 \u0431\u0430\u0439\u0442 \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u0430\u0445 \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043d\u0438 \u043e\u0442 \u043c\u0430\u0448\u0438\u043d\u044b, \u043d\u0438 \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430.\u0427\u0442\u043e \u0434\u0430\u0451\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u0440\u043e\u0433\u0430\u0412\u0442\u043e\u0440\u043e\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f \u2014 \u043f\u043e\u0440\u043e\u0433 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0422\u0435 \u0436\u0435 \u043e\u0442\u0447\u0451\u0442\u044b \u0441 DOTNET_GCLOHThreshold=0x30000, \u043f\u043e\u0440\u043e\u0433 196\u00a0608:\/\/ PoolProof, \u0432\u044b\u0432\u043e\u0434 \u043f\u0440\u0438 DOTNET_GCLOHThreshold=0x30000=== \u0413\u0434\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0440\u043e\u0433 \u043a\u0443\u0447\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 ===\u043f\u043e\u0440\u043e\u0433 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438: 85 000\u043f\u0435\u0440\u0432\u0430\u044f \u0434\u043b\u0438\u043d\u0430 byte[], \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0430\u044f \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u043e\u043b\u0435\u043d\u0438\u0435: 196 584\u0440\u0430\u0437\u043c\u0435\u0440 \u0431\u0430\u043a\u0435\u0442\u0430 \u0434\u043b\u044f \u043d\u0435\u0451: 262 144\u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0434\u043b\u0438\u043d\u0430,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-489383","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/489383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=489383"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/489383\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=489383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=489383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=489383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}