{"id":314674,"date":"2020-12-11T09:00:21","date_gmt":"2020-12-11T09:00:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=314674"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=314674","title":{"rendered":"\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c C# \u0438 C++ \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0411\u044b\u0442\u0443\u0435\u0442 \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e C# \u043d\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u0438 \u043c\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0435: JIT-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u043b\u0435\u0442\u0443 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u043c\u0438, \u0443 \u043d\u0435\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 C++, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043c\u0438\u043d\u0443\u0442\u044b \u0438 \u0434\u0430\u0436\u0435 \u0447\u0430\u0441\u044b.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0433\u043e\u0434\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c JIT-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0432\u043e\u0437\u0440\u043e\u0441\u043b\u0430, \u0434\u0430 \u0438 \u0432 \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0437\u0430\u0432\u0435\u0437\u043b\u0438 \u0440\u044f\u0434 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0438\u0448\u0435\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/hardware-intrinsics-in-net-core\/\" rel=\"noopener noreferrer nofollow\">\u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0438<\/a>.<\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0441\u0442\u0430\u043b\u043e \u043c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e: \u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432 2020 \u0433\u043e\u0434\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f .NET 5.0, \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0443\u043f\u0430\u043b \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 C++? \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e.<\/p>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>\u042f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043f\u0440\u0438\u0447\u0451\u043c \u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u0436\u043e\u043d\u0433\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0438\u0440\u043f\u0438\u0447\u0438\u043a\u0430\u043c\u0438 \u0432 Python, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0438, \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e. \u041a\u043e\u0434 \u043d\u0430 Python \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0433\u043e, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 C++ \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 C# \u0438 Java. \u0412 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0438\u0445 \u0441\u043b\u043e\u0432 &#8212; \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/imagej.net\/Fiji\" rel=\"noopener noreferrer nofollow\">Fiji<\/a>.<\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b C#, \u0430 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u043d\u0430 C++, \u043f\u0438\u0445\u0430\u043b \u0432 \u043b\u0438\u0431\u0443 \u0438 \u0434\u0451\u0440\u0433\u0430\u043b \u043b\u0438\u0431\u0443 \u0438\u0437 C#. \u041d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u0434\u0430 \u0438 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u044b\u043b\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e.<\/p>\n<p>\u041d\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0434\u0430\u0432\u043d\u043e, \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440 .NET \u0448\u0430\u0433\u043d\u0443\u043b \u0434\u0430\u043b\u0435\u043a\u043e \u0432\u043f\u0435\u0440\u0451\u0434, \u0438 \u043c\u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043c\u043e\u0433\u0443 \u043b\u0438 \u044f \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 C++ \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430 C#?<\/p>\n<h2>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/h2>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0436\u0435 \u044f\u0437\u044b\u043a\u0438 \u044f \u0431\u0443\u0434\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439: \u0441\u0443\u043c\u043c\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043f\u043e\u0432\u043e\u0440\u043e\u0442, \u0441\u0432\u0451\u0440\u0442\u043a\u0430, \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u0430\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 C++. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0432\u0451\u0440\u0442\u043a\u0438.<\/p>\n<p> \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u0440\u043e\u043c\u0435 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438, \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u043e \u0442\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 C# \u0438 C++:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u0438\u043f\u0430 GetPixel(x, y) \u0438 SetPixel(x, y, value);<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438 \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u043a\u043e\u0432 (AVX).<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Array.Sort, std::sort), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u0431\u044b\u043b\u043e, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0412 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0440\u0430\u0432\u043d\u044f\u0442\u044c \u044f\u0437\u044b\u043a\u0438 \u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445, \u044f \u0432 C# \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b unmanaged \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0441\u044f \u043a \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043d\u0430 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b. \u0410 \u0442\u043e \u043a\u0430\u043a-\u0442\u043e \u043d\u0435\u0447\u0435\u0441\u0442\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e C++ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 UB \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 C# &#8212; \u043d\u0435\u0442.<\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/e673\/csvscpp_improc\" rel=\"noopener noreferrer nofollow\">Github<\/a>, \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u044e\u0434\u0430 \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0438 \u043a\u043e\u0434\u0430 \u044f \u043d\u0435 \u0432\u0438\u0436\u0443, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043d\u0430 C#:<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0443\u043c\u043c\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>[MethodImpl(MethodImplOptions.AggressiveOptimization)] public static void Sum_ThisProperty(NativeImage&lt;float&gt; img1, NativeImage&lt;float&gt; img2, NativeImage&lt;float&gt; res) {     for (var j = 0; j &lt; res.Height; j++)     for (var i = 0; i &lt; res.Width; i++)         res[i, j] = img1[i, j] + img2[i, j]; }  [MethodImpl(MethodImplOptions.AggressiveOptimization)] public static void Sum_Optimized(NativeImage&lt;float&gt; img1, NativeImage&lt;float&gt; img2, NativeImage&lt;float&gt; res) {     var w = res.Width;      for (var j = 0; j &lt; res.Height; j++)     {         var p1 = img1.PixelAddr(0, j);         var p2 = img2.PixelAddr(0, j);         var r = res.PixelAddr(0, j);          for (var i = 0; i &lt; w; i++)             r[i] = p1[i] + p2[i];     } }  [MethodImpl(MethodImplOptions.AggressiveOptimization)] public static void Sum_Avx(NativeImage&lt;float&gt; img1, NativeImage&lt;float&gt; img2, NativeImage&lt;float&gt; res) {     var w8 = res.Width \/ 8 * 8;      for (var j = 0; j &lt; res.Height; j++)     {         var p1 = img1.PixelAddr(0, j);         var p2 = img2.PixelAddr(0, j);         var r = res.PixelAddr(0, j);\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430          for (var i = 0; i &lt; w8; i += 8)         {             Avx.StoreAligned(r, Avx.Add(Avx.LoadAlignedVector256(p1), Avx.LoadAlignedVector256(p2)));              p1 += 8;             p2 += 8;             r += 8;         }                  for (var i = w8; i &lt; res.Width; i++)             *r++ = *p1++ + *p2++;     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c. \u0412 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b (1\/10 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c) \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0434\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 256&#215;256 \u0432 \u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044f\u0445 \u0441\u0435\u0440\u043e\u0433\u043e \u0441 \u0442\u0438\u043f\u043e\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u044f float 32 bit.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<\/td>\n<td>\n<p>dotnet build -c Release<\/p>\n<\/td>\n<td>\n<p>g++ 10.2.0 -O0<\/p>\n<\/td>\n<td>\n<p>g++ 10.2.0 -O1<\/p>\n<\/td>\n<td>\n<p>g++ 10.2.0 -O2<\/p>\n<\/td>\n<td>\n<p>g++ 10.2.0 -O3<\/p>\n<\/td>\n<td>\n<p>clang 11.0.0 -O2<\/p>\n<\/td>\n<td>\n<p>clang 11.0.0 -O3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Sum (naive)<\/p>\n<\/td>\n<td>\n<p>115.8<\/p>\n<\/td>\n<td>\n<p>757.6<\/p>\n<\/td>\n<td>\n<p>124.4<\/p>\n<\/td>\n<td>\n<p>36.26<\/p>\n<\/td>\n<td>\n<p>19.51<\/p>\n<\/td>\n<td>\n<p>20.14<\/p>\n<\/td>\n<td>\n<p>19.81<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Sum (opt)<\/p>\n<\/td>\n<td>\n<p>40.69<\/p>\n<\/td>\n<td>\n<p>255.6<\/p>\n<\/td>\n<td>\n<p>36.07<\/p>\n<\/td>\n<td>\n<p>24.48<\/p>\n<\/td>\n<td>\n<p>19.60<\/p>\n<\/td>\n<td>\n<p>20.11<\/p>\n<\/td>\n<td>\n<p>19.81<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Sum (avx)<\/p>\n<\/td>\n<td>\n<p>21.15<\/p>\n<\/td>\n<td>\n<p>60.41<\/p>\n<\/td>\n<td>\n<p>20.00<\/p>\n<\/td>\n<td>\n<p>20.18<\/p>\n<\/td>\n<td>\n<p>20.37<\/p>\n<\/td>\n<td>\n<p>20.23<\/p>\n<\/td>\n<td>\n<p>20.20<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Rotate (naive)<\/p>\n<\/td>\n<td>\n<p>90.29<\/p>\n<\/td>\n<td>\n<p>500.3<\/p>\n<\/td>\n<td>\n<p>87.15<\/p>\n<\/td>\n<td>\n<p>36.01<\/p>\n<\/td>\n<td>\n<p>14.49<\/p>\n<\/td>\n<td>\n<p>14.04<\/p>\n<\/td>\n<td>\n<p>14.16<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Rotate (opt)<\/p>\n<\/td>\n<td>\n<p>34.99<\/p>\n<\/td>\n<td>\n<p>237.1<\/p>\n<\/td>\n<td>\n<p>35.11<\/p>\n<\/td>\n<td>\n<p>34.17<\/p>\n<\/td>\n<td>\n<p>14.55<\/p>\n<\/td>\n<td>\n<p>14.10<\/p>\n<\/td>\n<td>\n<p>14.27<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Rotate (avx)<\/p>\n<\/td>\n<td>\n<p>14.83<\/p>\n<\/td>\n<td>\n<p>51.04<\/p>\n<\/td>\n<td>\n<p>14.14<\/p>\n<\/td>\n<td>\n<p>14.25<\/p>\n<\/td>\n<td>\n<p>14.37<\/p>\n<\/td>\n<td>\n<p>14.22<\/p>\n<\/td>\n<td>\n<p>14.72<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Median 3&#215;3<\/p>\n<\/td>\n<td>\n<p>4163<\/p>\n<\/td>\n<td>\n<p>26660<\/p>\n<\/td>\n<td>\n<p>2930<\/p>\n<\/td>\n<td>\n<p>1607<\/p>\n<\/td>\n<td>\n<p>2508<\/p>\n<\/td>\n<td>\n<p>2301<\/p>\n<\/td>\n<td>\n<p>2330<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Median 5&#215;5<\/p>\n<\/td>\n<td>\n<p>11550<\/p>\n<\/td>\n<td>\n<p>10090<\/p>\n<\/td>\n<td>\n<p>8240<\/p>\n<\/td>\n<td>\n<p>5554<\/p>\n<\/td>\n<td>\n<p>5870<\/p>\n<\/td>\n<td>\n<p>5610<\/p>\n<\/td>\n<td>\n<p>6051<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Median 7&#215;7<\/p>\n<\/td>\n<td>\n<p>23540<\/p>\n<\/td>\n<td>\n<p>24470<\/p>\n<\/td>\n<td>\n<p>17540<\/p>\n<\/td>\n<td>\n<p>13640<\/p>\n<\/td>\n<td>\n<p>12620<\/p>\n<\/td>\n<td>\n<p>12920<\/p>\n<\/td>\n<td>\n<p>13510<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Convolve 7&#215;7 (naive)<\/p>\n<\/td>\n<td>\n<p>5519<\/p>\n<\/td>\n<td>\n<p>30900<\/p>\n<\/td>\n<td>\n<p>3240<\/p>\n<\/td>\n<td>\n<p>3694<\/p>\n<\/td>\n<td>\n<p>2775<\/p>\n<\/td>\n<td>\n<p>3047<\/p>\n<\/td>\n<td>\n<p>2761<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Convolve 7&#215;7 (opt)<\/p>\n<\/td>\n<td>\n<p>2913<\/p>\n<\/td>\n<td>\n<p>11780<\/p>\n<\/td>\n<td>\n<p>2759<\/p>\n<\/td>\n<td>\n<p>2628<\/p>\n<\/td>\n<td>\n<p>2754<\/p>\n<\/td>\n<td>\n<p>2434<\/p>\n<\/td>\n<td>\n<p>2262<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Convolve 7&#215;7 (avx)<\/p>\n<\/td>\n<td>\n<p>709.2<\/p>\n<\/td>\n<td>\n<p>3759<\/p>\n<\/td>\n<td>\n<p>729.8<\/p>\n<\/td>\n<td>\n<p>669.8<\/p>\n<\/td>\n<td>\n<p>684.2<\/p>\n<\/td>\n<td>\n<p>643.8<\/p>\n<\/td>\n<td>\n<p>638.3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Convolve 7&#215;7 (avx*)<\/p>\n<\/td>\n<td>\n<p>505.6<\/p>\n<\/td>\n<td>\n<p>2984<\/p>\n<\/td>\n<td>\n<p>523.4<\/p>\n<\/td>\n<td>\n<p>511.5<\/p>\n<\/td>\n<td>\n<p>507.8<\/p>\n<\/td>\n<td>\n<p>443.2<\/p>\n<\/td>\n<td>\n<p>443.3<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/em>: Convolve 7&#215;7 (avx*) &#8212; \u044d\u0442\u043e \u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u0431\u0435\u0437 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u044f\u0434\u0440\u0430 \u0441\u0432\u0451\u0440\u0442\u043a\u0438.<\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 Core i7-2600K @ 4.0 GHz.<\/p>\n<p>\u0418\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (avx), \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 C#, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 C++. \u0423\u0440\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430 C# \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0433\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443!<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0445 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 C# \u0442\u043e\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u0430, \u0438 C# \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043c, \u0433\u0434\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 C++ \u0441\u043c\u043e\u0433 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u0410 \u0432\u043e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0432 C# \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0438 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 C++ \u043e\u0442 2 \u0434\u043e 6 \u0440\u0430\u0437. \u041d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e \u0438 \u043d\u0435 \u0432\u0430\u0436\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u0414\u0430, \u043d\u0430 C# \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0438\u0442\u0435\u0442 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441 C++. \u041d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u043a \u0440\u0443\u0447\u043d\u044b\u043c\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u0432 \u043a\u043e\u0434\u0435: \u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 C++ \u0434\u0435\u043b\u0430\u0435\u0442 \u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0432 C# \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a C#, \u0442\u043e \u043f\u0438\u0448\u0438\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0430 C++.<\/p>\n<p>P.S. \u0412 .NET \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043a\u0438\u043b\u043b\u0435\u0440-\u0444\u0438\u0447\u0430 &#8212; \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435. \u0415\u0441\u043b\u0438 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c), \u0442\u043e \u0432 C++ \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0437 \u043a\u0438\u0440\u043f\u0438\u0447\u0438\u043a\u043e\u0432 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0432 C# \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0432 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<\/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\/post\/532442\/\"> https:\/\/habr.com\/ru\/post\/532442\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0411\u044b\u0442\u0443\u0435\u0442 \u043c\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e C# \u043d\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u0438 \u043c\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0435: JIT-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u043b\u0435\u0442\u0443 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430\u043c\u0438, \u0443 \u043d\u0435\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 C++, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u043c\u0438\u043d\u0443\u0442\u044b \u0438 \u0434\u0430\u0436\u0435 \u0447\u0430\u0441\u044b.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0433\u043e\u0434\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c JIT-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0432\u043e\u0437\u0440\u043e\u0441\u043b\u0430, \u0434\u0430 \u0438 \u0432 \u0441\u0430\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0437\u0430\u0432\u0435\u0437\u043b\u0438 \u0440\u044f\u0434 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0438\u0448\u0435\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/hardware-intrinsics-in-net-core\/\" rel=\"noopener noreferrer nofollow\">\u0438\u043d\u0442\u0440\u0438\u043d\u0441\u0438\u043a\u0438<\/a>.<\/p>\n<p>\u0418 \u0432\u043e\u0442 \u0441\u0442\u0430\u043b\u043e \u043c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e: \u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432 2020 \u0433\u043e\u0434\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f .NET 5.0, \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0443\u043f\u0430\u043b \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 C++? \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e.<\/p>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>\u042f \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043f\u0440\u0438\u0447\u0451\u043c \u043d\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u0436\u043e\u043d\u0433\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0438\u0440\u043f\u0438\u0447\u0438\u043a\u0430\u043c\u0438 \u0432 Python, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0438, \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e. \u041a\u043e\u0434 \u043d\u0430 Python \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435\u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0433\u043e, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 C++ \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 C# \u0438 Java. \u0412 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0438\u0445 \u0441\u043b\u043e\u0432 &#8212; \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/imagej.net\/Fiji\" rel=\"noopener noreferrer nofollow\">Fiji<\/a>.<\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b C#, \u0430 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u043d\u0430 C++, \u043f\u0438\u0445\u0430\u043b \u0432 \u043b\u0438\u0431\u0443 \u0438 \u0434\u0451\u0440\u0433\u0430\u043b \u043b\u0438\u0431\u0443 \u0438\u0437 C#. \u041d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0442\u0440\u0430\u0434\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u0434\u0430 \u0438 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u044b\u043b\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e.<\/p>\n<p>\u041d\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0434\u0430\u0432\u043d\u043e, \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440 .NET \u0448\u0430\u0433\u043d\u0443\u043b \u0434\u0430\u043b\u0435\u043a\u043e \u0432\u043f\u0435\u0440\u0451\u0434, \u0438 \u043c\u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043c\u043e\u0433\u0443 \u043b\u0438 \u044f \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 C++ \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430 C#?<\/p>\n<h2>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439<\/h2>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0436\u0435 \u044f\u0437\u044b\u043a\u0438 \u044f \u0431\u0443\u0434\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439: \u0441\u0443\u043c\u043c\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043f\u043e\u0432\u043e\u0440\u043e\u0442, \u0441\u0432\u0451\u0440\u0442\u043a\u0430, \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u0430\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 C++. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0432\u0451\u0440\u0442\u043a\u0438.<\/p>\n<p> \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u0440\u043e\u043c\u0435 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438, \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u043e \u0442\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 C# \u0438 C++:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0442\u0438\u043f\u0430 GetPixel(x, y) \u0438 SetPixel(x, y, value);<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438 \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u043d\u0442\u0440\u0438\u043d\u0441\u043a\u043e\u0432 (AVX).<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (Array.Sort, std::sort), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u0431\u044b\u043b\u043e, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0430 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0412 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0440\u0430\u0432\u043d\u044f\u0442\u044c \u044f\u0437\u044b\u043a\u0438 \u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445, \u044f \u0432 C# \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b unmanaged \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0441\u044f \u043a \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043d\u0430 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b. \u0410 \u0442\u043e \u043a\u0430\u043a-\u0442\u043e \u043d\u0435\u0447\u0435\u0441\u0442\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e C++ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 UB \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 C# &#8212; \u043d\u0435\u0442.<\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u044b\u043b\u043e\u0436\u0435\u043d\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/e673\/csvscpp_improc\" rel=\"noopener noreferrer nofollow\">Github<\/a>, \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u044e\u0434\u0430 \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0438 \u043a\u043e\u0434\u0430 \u044f \u043d\u0435 \u0432\u0438\u0436\u0443, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u043d\u0430 C#:<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0443\u043c\u043c\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>[MethodImpl(MethodImplOptions.AggressiveOptimization)] public static void Sum_ThisProperty(NativeImage&lt;float&gt; img1, NativeImage&lt;float&gt; img2, NativeImage&lt;float&gt; res) {     for (var j = 0; j &lt; res.Height; j++)     for (var i = 0; i &lt; res.Width; i++)         res[i, j] = img1[i, j] + img2[i, j]; }  [MethodImpl(MethodImplOptions.AggressiveOptimization)] public static void Sum_Optimized(NativeImage&lt;float&gt; img1, NativeImage&lt;float&gt; img2, NativeImage&lt;float&gt; res) {     var w = res.Width;      for (var j = 0; j &lt; res.Height; j++)     {         var p1 = img1.PixelAddr(0, j);         var p2 = img2.PixelAddr(0, j);         var r = res.PixelAddr(0, j);          for (var i = 0; i &lt; w; i++)             r[i] = p1[i] + p2[i];     } }  [MethodImpl(MethodImplOptions.AggressiveOptimization)] public static void Sum_Avx(NativeImage&lt;float&gt; img1, NativeImage&lt;float&gt; img2, NativeImage&lt;float&gt; res) {     var w8 = res.Width \/ 8 * 8;      for (var j = 0; j &lt; res.Height; j++)     {         var p1 = img1.PixelAddr(0, j);         var p2 = img2.PixelAddr(0, j);         var r = res.PixelAddr(0, j);\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430          for (var i = 0; i &lt; w8; i += 8)         {             Avx.StoreAligned(r, Avx.Add(Avx.LoadAlignedVector256(p1), Avx.LoadAlignedVector256(p2)));              p1 += 8;             p2 += 8;             r += 8;         }                  for (var i = w8; i &lt; res.Width; i++)             *r++ = *p1++ + *p2++;     } } <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c. \u0412 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b (1\/10 \u043f\u0435\u0440\u0446\u0435\u043d\u0442\u0438\u043b\u044c) \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0434\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 256&#215;256 \u0432 \u0433\u0440\u0430\u0434\u0430\u0446\u0438\u044f\u0445 \u0441\u0435\u0440\u043e\u0433\u043e \u0441 \u0442\u0438\u043f\u043e\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u044f float 32 bit.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<\/td>\n<td>\n<p>dotnet build -c Release<\/p>\n<\/td>\n<td>\n<p>g++ 10.2.0 -O0<\/p>\n<\/td>\n<td>\n<p>g++ 10.2.0 -O1<\/p>\n<\/td>\n<td>\n<p>g++ 10.2.0 -O2<\/p>\n<\/td>\n<td>\n<p>g++ 10.2.0 -O3<\/p>\n<\/td>\n<td>\n<p>clang 11.0.0 -O2<\/p>\n<\/td>\n<td>\n<p>clang 11.0.0 -O3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Sum (naive)<\/p>\n<\/td>\n<td>\n<p>115.8<\/p>\n<\/td>\n<td>\n<p>757.6<\/p>\n<\/td>\n<td>\n<p>124.4<\/p>\n<\/td>\n<td>\n<p>36.26<\/p>\n<\/td>\n<td>\n<p>19.51<\/p>\n<\/td>\n<td>\n<p>20.14<\/p>\n<\/td>\n<td>\n<p>19.81<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Sum (opt)<\/p>\n<\/td>\n<td>\n<p>40.69<\/p>\n<\/td>\n<td>\n<p>255.6<\/p>\n<\/td>\n<td>\n<p>36.07<\/p>\n<\/td>\n<td>\n<p>24.48<\/p>\n<\/td>\n<td>\n<p>19.60<\/p>\n<\/td>\n<td>\n<p>20.11<\/p>\n<\/td>\n<td>\n<p>19.81<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Sum (avx)<\/p>\n<\/td>\n<td>\n<p>21.15<\/p>\n<\/td>\n<td>\n<p>60.41<\/p>\n<\/td>\n<td>\n<p>20.00<\/p>\n<\/td>\n<td>\n<p>20.18<\/p>\n<\/td>\n<td>\n<p>20.37<\/p>\n<\/td>\n<td>\n<p>20.23<\/p>\n<\/td>\n<td>\n<p>20.20<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Rotate (naive)<\/p>\n<\/td>\n<td>\n<p>90.29<\/p>\n<\/td>\n<td>\n<p>500.3<\/p>\n<\/td>\n<td>\n<p>87.15<\/p>\n<\/td>\n<td>\n<p>36.01<\/p>\n<\/td>\n<td>\n<p>14.49<\/p>\n<\/td>\n<td>\n<p>14.04<\/p>\n<\/td>\n<td>\n<p>14.16<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Rotate (opt)<\/p>\n<\/td>\n<td>\n<p>34.99<\/p>\n<\/td>\n<td>\n<p>237.1<\/p>\n<\/td>\n<td>\n<p>35.11<\/p>\n<\/td>\n<td>\n<p>34.17<\/p>\n<\/td>\n<td>\n<p>14.55<\/p>\n<\/td>\n<td>\n<p>14.10<\/p>\n<\/td>\n<td>\n<p>14.27<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Rotate (avx)<\/p>\n<\/td>\n<td>\n<p>14.83<\/p>\n<\/td>\n<td>\n<p>51.04<\/p>\n<\/td>\n<td>\n<p>14.14<\/p>\n<\/td>\n<td>\n<p>14.25<\/p>\n<\/td>\n<td>\n<p>14.37<\/p>\n<\/td>\n<td>\n<p>14.22<\/p>\n<\/td>\n<td>\n<p>14.72<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Median 3&#215;3<\/p>\n<\/td>\n<td>\n<p>4163<\/p>\n<\/td>\n<td>\n<p>26660<\/p>\n<\/td>\n<td>\n<p>2930<\/p>\n<\/td>\n<td>\n<p>1607<\/p>\n<\/td>\n<td>\n<p>2508<\/p>\n<\/td>\n<td>\n<p>2301<\/p>\n<\/td>\n<td>\n<p>2330<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Median 5&#215;5<\/p>\n<\/td>\n<td>\n<p>11550<\/p>\n<\/td>\n<td>\n<p>10090<\/p>\n<\/td>\n<td>\n<p>8240<\/p>\n<\/td>\n<td>\n<p>5554<\/p>\n<\/td>\n<td>\n<p>5870<\/p>\n<\/td>\n<td>\n<p>5610<\/p>\n<\/td>\n<td>\n<p>6051<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Median 7&#215;7<\/p>\n<\/td>\n<td>\n<p>23540<\/p>\n<\/td>\n<td>\n<p>24470<\/p>\n<\/td>\n<td>\n<p>17540<\/p>\n<\/td>\n<td>\n<p>13640<\/p>\n<\/td>\n<td>\n<p>12620<\/p>\n<\/td>\n<td>\n<p>12920<\/p>\n<\/td>\n<td>\n<p>13510<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Convolve 7&#215;7 (naive)<\/p>\n<\/td>\n<td>\n<p>5519<\/p>\n<\/td>\n<td>\n<p>30900<\/p>\n<\/td>\n<td>\n<p>3240<\/p>\n<\/td>\n<td>\n<p>3694<\/p>\n<\/td>\n<td>\n<p>2775<\/p>\n<\/td>\n<td>\n<p>3047<\/p>\n<\/td>\n<td>\n<p>2761<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Convolve 7&#215;7 (opt)<\/p>\n<\/td>\n<td>\n<p>2913<\/p>\n<\/td>\n<td>\n<p>11780<\/p>\n<\/td>\n<td>\n<p>2759<\/p>\n<\/td>\n<td>\n<p>2628<\/p>\n<\/td>\n<td>\n<p>2754<\/p>\n<\/td>\n<td>\n<p>2434<\/p>\n<\/td>\n<td>\n<p>2262<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Convolve 7&#215;7 (avx)<\/p>\n<\/td>\n<td>\n<p>709.2<\/p>\n<\/td>\n<td>\n<p>3759<\/p>\n<\/td>\n<td>\n<p>729.8<\/p>\n<\/td>\n<td>\n<p>669.8<\/p>\n<\/td>\n<td>\n<p>684.2<\/p>\n<\/td>\n<td>\n<p>643.8<\/p>\n<\/td>\n<td>\n<p>638.3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"190\" width=\"190\">\n<p>Convolve 7&#215;7 (avx*)<\/p>\n<\/td>\n<td>\n<p>505.6<\/p>\n<\/td>\n<td>\n<p>2984<\/p>\n<\/td>\n<td>\n<p>523.4<\/p>\n<\/td>\n<td>\n<p>511.5<\/p>\n<\/td>\n<td>\n<p>507.8<\/p>\n<\/td>\n<td>\n<p>443.2<\/p>\n<\/td>\n<td>\n<p>443.3<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/em>: Convolve 7&#215;7 (avx*) &#8212; \u044d\u0442\u043e \u0441\u0432\u0451\u0440\u0442\u043a\u0430 \u0431\u0435\u0437 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u044f\u0434\u0440\u0430 \u0441\u0432\u0451\u0440\u0442\u043a\u0438.<\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 Core i7-2600K @ 4.0 GHz.<\/p>\n<p>\u0418\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (avx), \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 C#, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 C++. \u0423\u0440\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430 C# \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0433\u0430\u0442\u044c \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0443!<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0445 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 C# \u0442\u043e\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u0430, \u0438 C# \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043c, \u0433\u0434\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 C++ \u0441\u043c\u043e\u0433 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u0410 \u0432\u043e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0432 C# \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0435\u043b\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0438 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 C++ \u043e\u0442 2 \u0434\u043e 6 \u0440\u0430\u0437. \u041d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e \u0438 \u043d\u0435 \u0432\u0430\u0436\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u0414\u0430, \u043d\u0430 C# \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0438\u0442\u0435\u0442 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441 C++. \u041d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u043a \u0440\u0443\u0447\u043d\u044b\u043c\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c \u0432 \u043a\u043e\u0434\u0435: \u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 C++ \u0434\u0435\u043b\u0430\u0435\u0442 \u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435, \u0432 C# \u043d\u0443\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a C#, \u0442\u043e \u043f\u0438\u0448\u0438\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u043d\u0430 C++.<\/p>\n<p>P.S. \u0412 .NET \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043a\u0438\u043b\u043b\u0435\u0440-\u0444\u0438\u0447\u0430 &#8212; \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435. \u0415\u0441\u043b\u0438 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c), \u0442\u043e \u0432 C++ \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0437 \u043a\u0438\u0440\u043f\u0438\u0447\u0438\u043a\u043e\u0432 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0432 C# \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0432 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<\/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\/post\/532442\/\"> https:\/\/habr.com\/ru\/post\/532442\/<\/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-314674","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314674","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=314674"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314674\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=314674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=314674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=314674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}