{"id":346743,"date":"2023-03-14T21:01:03","date_gmt":"2023-03-14T21:01:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=346743"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2023-03-14T21:01:03","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=346743","title":{"rendered":"<span>Inline \u0438 throw<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/792\/3c4\/a23\/7923c4a239db76a1bf7e1af01ca24a9a.png\" alt=\"Picture from mobillegends.net about inline functions\" title=\"Picture from mobillegends.net about inline functions\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/792\/3c4\/a23\/7923c4a239db76a1bf7e1af01ca24a9a.png\"\/><\/p>\n<div><figcaption>Picture from mobillegends.net about inline functions<\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0437\u0443\u0447\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u0445, \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0444\u0430\u043a\u0442: \u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442\u044c Exception,\u00a0<a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/d6b89c66d492c1e0b0a88d797264039c50c4f4b7\/src\/libraries\/System.Private.CoreLib\/src\/System\/Collections\/Generic\/Dictionary.cs#L1361\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0434\u0451\u0440\u0433\u0430\u044e\u0442 \u043c\u0435\u0442\u043e\u0434<\/a>\u00a0\u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 throw. \u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u044f \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e &#8212; \u0438\u043c\u0435\u0442\u044c \u0432\u0441\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0438 \u0442\u0430\u043c \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0438\u0445 \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435\u043c. \u042d\u0442\u043e \u0434\u0430, \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e. \u041d\u043e \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441&#8230;<\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#8212; inline. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e JIT \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0442\u0430\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0438\u043d\u043b\u0430\u0439\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0441 throw, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0431\u0432\u044f\u0437\u043a\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u0432\u044b\u0431\u0440\u043e\u0441\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u043c\u0435\u0442\u043e\u0434, JIT \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0435\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e. \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043d\u0435\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433, \u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u0438\u043d\u043b\u0430\u0439\u043d\u0435\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 throw, \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043f\u043e\u0440\u043e\u0433.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 inline \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/devblogs.microsoft.com\/premier-developer\/a-common-execution-path-optimization\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0443\u0442<\/a>. \u0423\u0437\u043d\u0430\u0442\u044c, \u0447\u0435\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f JIT \u043f\u0440\u0438 inline&#8217;e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,\u00a0<a href=\"https:\/\/aakinshin.net\/ru\/posts\/inlining-and-starg\/\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/temofeev.ru\/info\/articles\/kak-jit-inlaynit-nash-c-kod-evristiki\/\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a> (\u0440\u0430\u043d\u044c\u0448\u0435 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u0447\u0435\u0437\u043b\u0430). \u041c\u044b \u0436\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a benchmark&#8217;\u0443.<\/p>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c inline<\/h3>\n<p>\u0421\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041d\u0443,\u00a0<a href=\"https:\/\/gist.github.com\/teoadal\/b93f7fd98f00f8f988a09ead990e2fbf\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0447\u0442\u0438<\/a>. <\/p>\n<pre><code>public sealed class InliningService {         private readonly int _min;     ...     [MethodImpl(MethodImplOptions.AggressiveInlining)]         public int AggressiveInline(int a, int b) {             if (a &lt; _min || b &lt; _min)         throw new InvalidOperationException();              return a + b;     }  public int AutoInline(int a, int b) {     if (_min &lt; 0 || b &lt; _min) Errors.InvalidOperation();                return a + b;     }  public int WithoutInline(int a, int b) {     if (a &lt; _min || b &lt; _min)          throw new InvalidOperationException();     return a + b;     }<\/code><\/pre>\n<p>\u0412 \u043e\u0434\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c throw \u043f\u0440\u044f\u043c\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 (Without Inline), \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0438\u043c \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0437\u0430\u0438\u043d\u043b\u0430\u0439\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 (Aggressive Inline), \u0430 \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u0441\u044f \u043d\u0430 JIT \u0438 \u0432\u044b\u0437\u043e\u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430 (Auto Inline).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bfe\/a20\/2e3\/bfea202e334c9781719d7dfc1a168a1d.png\" alt=\"Benchmark: inline method in C#\" title=\"Benchmark: inline method in C#\" width=\"1726\" height=\"445\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bfe\/a20\/2e3\/bfea202e334c9781719d7dfc1a168a1d.png\"\/><\/p>\n<div><figcaption>Benchmark: inline method in C#<\/figcaption><\/div>\n<\/figure>\n<p>\u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 benchmark, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 .NET \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f. \u0421\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u0435\u0437 inline&#8217;a \u043d\u0430 .NET Core 3.1 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 IL-\u043a\u043e\u0434\u0430 (Code Size) \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 framework&#8217;\u0430\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439.<\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u0438\u043d\u043b\u0430\u0439\u043d\u0435\u043d, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u043d\u0438\u0436\u0435, \u0447\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044f, \u0433\u0434\u0435 JIT \u043f\u0440\u0438\u043d\u044f\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c inline. \u041f\u0440\u0438\u0447\u0451\u043c \u043f\u043e\u0447\u0442\u0438 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u044f\u0442\u0430\u0442\u044c throw \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u0442\u0430\u043c, \u0433\u0434\u0435 \u0432\u044b\u0431\u0440\u043e\u0441 Exception \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0440\u043e\u0433\u0438\u043c \u0438 \u043c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f \u043d\u0430 inline.<\/p>\n<p>\u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u043a\u043e\u043b\u043e\u043d\u043a\u0430 Code Size \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0451\u0442\u043a\u043e \u043d\u0430\u043c\u0435\u043a\u0430\u0435\u0442 \u043d\u0430\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e aggressive inline \u043c\u0435\u0442\u043e\u0434\u0430 \u0441 throw \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 JIT \u0441\u0434\u0435\u043b\u0430\u0442\u044c inline, \u043d\u043e \u043f\u0443\u0442\u0451\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043a\u043e\u0434\u0430. \u041f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 AutoInline &#8212; \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0434\u0440\u0430\u043c\u0430\u0442\u0438\u0447\u043d\u0430\u044f. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 inline \u043f\u043b\u043e\u0445, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u0432\u043b\u0438\u044f\u043b \u0431\u044b \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c inline&#8217;a \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c inline \u0442\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0433\u0434\u0435 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u043e.<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u0430-\u043b\u044f Errors \u0434\u043b\u044f \u0432\u044b\u0431\u0440\u043e\u0441\u0430 Exception&#8217;\u043e\u0432. \u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0431\u0440\u043e\u0441 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u0447\u0438\u0449\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 Errors \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e Exception, \u043d\u043e \u043b\u0443\u0447\u0448\u0435, \u0447\u0442\u043e\u0431\u044b throw \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b \u043f\u0440\u044f\u043c\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u0412\u0432\u0435\u0434\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0443 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 JIT&#8217;a \u043f\u043e \u0438\u043d\u043b\u0430\u0439\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0440\u043e\u0441 Exception \u0432 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043a\u043e\u0434\u0430, \u0433\u0434\u0435 \u043c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f \u043d\u0430 inline &#8212; \u043f\u043b\u043e\u0445\u0430\u044f \u0438\u0434\u0435\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u0435\u0448\u0430\u0435\u0442 JIT&#8217;\u0443 \u0437\u0430\u0438\u043d\u043b\u0430\u0439\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u043d\u0430\u0434\u043e \u0431\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.runtime.compilerservices.methodimplattribute?view=net-6.0\" rel=\"noopener noreferrer nofollow\">MethodImplAttribute<\/a>, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043d\u0430 \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 aggressive inline \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u043c\u0435\u0435\u0442\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 (benchmark) \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ol>\n<p>P.S.: \u041d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u00a0<a href=\"https:\/\/t.me\/csharp_gepard\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043b\u0435\u0433\u0443<\/a>\u00a0\u043f\u0440\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u0439\u0442\u0435, \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.  <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \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\/post\/722374\/\"> https:\/\/habr.com\/ru\/post\/722374\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\">\n<div><figcaption>Picture from mobillegends.net about inline functions<\/figcaption><\/div>\n<\/figure>\n<p>\u0418\u0437\u0443\u0447\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u0445, \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0444\u0430\u043a\u0442: \u0442\u0430\u043c, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442\u044c Exception,\u00a0<a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/d6b89c66d492c1e0b0a88d797264039c50c4f4b7\/src\/libraries\/System.Private.CoreLib\/src\/System\/Collections\/Generic\/Dictionary.cs#L1361\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0434\u0451\u0440\u0433\u0430\u044e\u0442 \u043c\u0435\u0442\u043e\u0434<\/a>\u00a0\u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 throw. \u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u044f \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e &#8212; \u0438\u043c\u0435\u0442\u044c \u0432\u0441\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0438 \u0442\u0430\u043c \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0438\u0445 \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435\u043c. \u042d\u0442\u043e \u0434\u0430, \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e. \u041d\u043e \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441&#8230;<\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 &#8212; inline. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e JIT \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0442\u0430\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0438\u043d\u043b\u0430\u0439\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0441 throw, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0431\u0432\u044f\u0437\u043a\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u0432\u044b\u0431\u0440\u043e\u0441\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u043c\u0435\u0442\u043e\u0434, JIT \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043d\u0435\u043a\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e. \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043d\u0435\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433, \u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u0438\u043d\u043b\u0430\u0439\u043d\u0435\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 throw, \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043f\u043e\u0440\u043e\u0433.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 inline \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/devblogs.microsoft.com\/premier-developer\/a-common-execution-path-optimization\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0443\u0442<\/a>. \u0423\u0437\u043d\u0430\u0442\u044c, \u0447\u0435\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0443\u0435\u0442\u0441\u044f JIT \u043f\u0440\u0438 inline&#8217;e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,\u00a0<a href=\"https:\/\/aakinshin.net\/ru\/posts\/inlining-and-starg\/\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/temofeev.ru\/info\/articles\/kak-jit-inlaynit-nash-c-kod-evristiki\/\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a> (\u0440\u0430\u043d\u044c\u0448\u0435 \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u0447\u0435\u0437\u043b\u0430). \u041c\u044b \u0436\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a benchmark&#8217;\u0443.<\/p>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c inline<\/h3>\n<p>\u0421\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f: \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041d\u0443,\u00a0<a href=\"https:\/\/gist.github.com\/teoadal\/b93f7fd98f00f8f988a09ead990e2fbf\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0447\u0442\u0438<\/a>. <\/p>\n<pre><code>public sealed class InliningService {         private readonly int _min;     ...     [MethodImpl(MethodImplOptions.AggressiveInlining)]         public int AggressiveInline(int a, int b) {             if (a &lt; _min || b &lt; _min)         throw new InvalidOperationException();              return a + b;     }  public int AutoInline(int a, int b) {     if (_min &lt; 0 || b &lt; _min) Errors.InvalidOperation();                return a + b;     }  public int WithoutInline(int a, int b) {     if (a &lt; _min || b &lt; _min)          throw new InvalidOperationException();     return a + b;     }<\/code><\/pre>\n<p>\u0412 \u043e\u0434\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c throw \u043f\u0440\u044f\u043c\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 (Without Inline), \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0438\u043c \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0437\u0430\u0438\u043d\u043b\u0430\u0439\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 (Aggressive Inline), \u0430 \u0432 \u0442\u0440\u0435\u0442\u044c\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u0441\u044f \u043d\u0430 JIT \u0438 \u0432\u044b\u0437\u043e\u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430 (Auto Inline).<\/p>\n<figure class=\"full-width\">\n<div><figcaption>Benchmark: inline method in C#<\/figcaption><\/div>\n<\/figure>\n<p>\u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 benchmark, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 .NET \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f. \u0421\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u0430 \u0431\u0435\u0437 inline&#8217;a \u043d\u0430 .NET Core 3.1 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0441\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u0433\u0440\u0435\u0448\u043d\u043e\u0441\u0442\u044c. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 IL-\u043a\u043e\u0434\u0430 (Code Size) \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0440\u0451\u0445 framework&#8217;\u0430\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439.<\/p>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u0438\u043d\u043b\u0430\u0439\u043d\u0435\u043d, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u043d\u0438\u0436\u0435, \u0447\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044f, \u0433\u0434\u0435 JIT \u043f\u0440\u0438\u043d\u044f\u043b \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c inline. \u041f\u0440\u0438\u0447\u0451\u043c \u043f\u043e\u0447\u0442\u0438 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u044f\u0442\u0430\u0442\u044c throw \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u0442\u0430\u043c, \u0433\u0434\u0435 \u0432\u044b\u0431\u0440\u043e\u0441 Exception \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0440\u043e\u0433\u0438\u043c \u0438 \u043c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f \u043d\u0430 inline.<\/p>\n<p>\u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u043a\u043e\u043b\u043e\u043d\u043a\u0430 Code Size \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0447\u0451\u0442\u043a\u043e \u043d\u0430\u043c\u0435\u043a\u0430\u0435\u0442 \u043d\u0430\u043c \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e aggressive inline \u043c\u0435\u0442\u043e\u0434\u0430 \u0441 throw \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 JIT \u0441\u0434\u0435\u043b\u0430\u0442\u044c inline, \u043d\u043e \u043f\u0443\u0442\u0451\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043a\u043e\u0434\u0430. \u041f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 AutoInline &#8212; \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0434\u0440\u0430\u043c\u0430\u0442\u0438\u0447\u043d\u0430\u044f. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 inline \u043f\u043b\u043e\u0445, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u0432\u043b\u0438\u044f\u043b \u0431\u044b \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c inline&#8217;a \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u044b \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c inline \u0442\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0433\u0434\u0435 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u043e.<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u0430-\u043b\u044f Errors \u0434\u043b\u044f \u0432\u044b\u0431\u0440\u043e\u0441\u0430 Exception&#8217;\u043e\u0432. \u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0431\u0440\u043e\u0441 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u0447\u0438\u0449\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430 Errors \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e Exception, \u043d\u043e \u043b\u0443\u0447\u0448\u0435, \u0447\u0442\u043e\u0431\u044b throw \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b \u043f\u0440\u044f\u043c\u043e \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u0412\u0432\u0435\u0434\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0443 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 JIT&#8217;a \u043f\u043e \u0438\u043d\u043b\u0430\u0439\u043d\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0440\u043e\u0441 Exception \u0432 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043a\u043e\u0434\u0430, \u0433\u0434\u0435 \u043c\u044b \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f \u043d\u0430 inline &#8212; \u043f\u043b\u043e\u0445\u0430\u044f \u0438\u0434\u0435\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u0435\u0448\u0430\u0435\u0442 JIT&#8217;\u0443 \u0437\u0430\u0438\u043d\u043b\u0430\u0439\u043d\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u043d\u0430\u0434\u043e \u0431\u0430\u043b\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.runtime.compilerservices.methodimplattribute?view=net-6.0\" rel=\"noopener noreferrer nofollow\">MethodImplAttribute<\/a>, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043d\u0430 \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 aggressive inline \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u043c\u0435\u0435\u0442\u0435 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 (benchmark) \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ol>\n<p>P.S.: \u041d\u0430\u0447\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u00a0<a href=\"https:\/\/t.me\/csharp_gepard\" rel=\"noopener noreferrer nofollow\">\u0442\u0435\u043b\u0435\u0433\u0443<\/a>\u00a0\u043f\u0440\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u0439\u0442\u0435, \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.  <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \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\/post\/722374\/\"> https:\/\/habr.com\/ru\/post\/722374\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-346743","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346743","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=346743"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/346743\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=346743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=346743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=346743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}