{"id":500829,"date":"2026-10-29T12:01:51","date_gmt":"2026-10-29T09:01:51","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=500829"},"modified":"2026-10-29T12:01:51","modified_gmt":"2026-10-29T09:01:51","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=500829","title":{"rendered":"\u041a\u043e\u0433\u0434\u0430 Python \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c: \u043f\u0438\u0448\u0435\u043c C\u2011\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0441\u00a0\u043d\u0443\u043b\u044f \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0441\u00a0pybind11\u00a0(\u0431\u043e\u043d\u0443\u0441 JIT\u2011\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440)"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043f\u0440\u043e\u0447\u0435\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e <code>pyrusmorph<\/code>\u00a0\u2014 python \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 30-\u043b\u0435\u0442\u043d\u0438\u043c \u0441++ \u044f\u0434\u0440\u043e\u043c <code>libmorph\/rus<\/code>. \u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u0443\u0434\u0438\u0432\u0438\u043b\u0438: <strong>\u0432 30\u00a0\u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 PyMorphy3<\/strong> \u043f\u0440\u0438\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u0435\u043a\u0441\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f. \u041a\u0430\u043a\u00a0\u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043f\u0438\u0448\u0435\u043c <code>import pyrusmorph<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u0441++ \u043a\u043e\u0434\u0443 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u043f\u0440\u044f\u043c\u043e \u0432\u043d\u0443\u0442\u0440\u0438 python.<\/p>\n<p>\u0412\u00a0\u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0440\u043e\u0439\u0442\u0438 \u044d\u0442\u043e\u0442 \u043f\u0443\u0442\u044c \u0441\u00a0\u043d\u0443\u043b\u044f. <strong>\u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a\u00a0\u0443\u0441\u0442\u0440\u043e\u0435\u043d Python \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb<\/strong>, \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <strong>\u0441\u0432\u043e\u0451 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c C\u2011API<\/strong>, \u0430\u00a0\u043f\u043e\u0442\u043e\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u00a0\u044d\u0442\u0443 \u0431\u043e\u043b\u044c \u043b\u0435\u0447\u0438\u0442 <code>pybind11<\/code>. \u0412\u00a0\u043a\u043e\u043d\u0446\u0435\u00a0\u2014 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u0442\u043e\u0438\u0442 \u043b\u0435\u0437\u0442\u044c \u0432\u00a0c++ \u0434\u043b\u044f\u00a0\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0411\u043e\u043d\u0443\u0441\u00a0\u2014 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u00a0\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435 python \u043a\u043e\u0434\u0430 (JIT\u2011\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440)<\/p>\n<hr\/>\n<h3>\u0427\u0430\u0441\u0442\u044c 1. \u041f\u043e\u0447\u0435\u043c\u0443 Python \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439? \u0410\u043d\u0430\u0442\u043e\u043c\u0438\u044f PyObject<\/h3>\n<p>\u0421\u00a0\u043d\u0430\u0447\u0430\u043b\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e\u00a0\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442. \u0412\u043e\u0437\u044c\u043c\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443: \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0434\u043b\u044f\u00a0\u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u0437\u00a0\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0447\u0438\u0441\u0435\u043b. <\/p>\n<pre><code class=\"python\">def sum_of_squares_py(numbers):    total = 0.0    for n in numbers:        total += n * n    return total<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u041d\u043e\u00a0\u0447\u0442\u043e\u00a0\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u00a0\u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435 \u0446\u0438\u043a\u043b\u0430? <\/p>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u00a0Python\u00a0\u2014 \u044d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>PyObject<\/code> \u0432\u00a0\u043a\u0443\u0447\u0435. \u0423\u00a0\u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c: <\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a\u00a0\u2014 16\u00a0\u0431\u0430\u0439\u0442<\/p>\n<\/li>\n<li>\n<p>\u0421\u0430\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0\u2014 8\u00a0\u0431\u0430\u0439\u0442 (<code>float<\/code>)<\/p>\n<\/li>\n<li>\n<p>\u041e\u0432\u0435\u0440\u0445\u0435\u0434 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0\u2014 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 (\u0433\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u043c\u0435\u0442\u0430\u2011\u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430)<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0438\u0448\u0435\u043c <code>n * n<\/code>, Python \u0434\u043e\u043b\u0436\u0435\u043d: <\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f <code>float<\/code><\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>float<\/code> \u0432\u00a0\u043a\u0443\u0447\u0435 \u0434\u043b\u044f\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c refcount, \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 <code>total += ...<\/code><\/p>\n<\/li>\n<li>\n<p>\u0423\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c refcount \u0443\u00a0\u0441\u0442\u0430\u0440\u043e\u0433\u043e <code>total<\/code><\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430(\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u043e\u00a0\u0432\u0441\u0435\u00a0\u0436\u0435)<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u00a0\u043e\u0434\u0438\u043d \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439\u00a0\u2014 \u044d\u0442\u043e <strong>\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/strong> \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0442\u0438\u043f\u043e\u0432. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 python \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439. \u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0448\u043d\u0435\u0439.<\/p>\n<p>\u0412\u00a0c\u0438\u2011\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0442\u0430\u00a0\u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u00a0\u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 <code>mulsd<\/code> \u043d\u0430\u0434 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c\u0438. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0439, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0442\u0430\u043a \u043a\u0430\u043a\u00a0c\u0438 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u044f\u0437\u044b\u043a, \u043d\u0435\u00a0\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0432\u00a0\u0441\u043a\u0440\u0438\u043f\u0442\u0430\u0445 (\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u043c\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438<\/p>\n<hr\/>\n<h3>\u0427\u0430\u0441\u0442\u044c 2. Python C\u2011API: \u043a\u0430\u043a\u00a0\u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043d\u0430\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/h3>\n<p>Python (\u0435\u0433\u043e \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f CPython) \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430\u00a0\u0441. \u0423\u00a0\u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c <strong>C\u2011API<\/strong>\u00a0\u2014 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 c\u2011\u043a\u043e\u0434\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u00a0python \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0442\u0430\u043a\u00a0\u0436\u0435, \u043a\u0430\u043a\u00a0\u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440. <\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u00a0\u2014 <code>PyObject<\/code>. \u042d\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f\u00a0\u0432\u0441\u0435\u0433\u043e \u0432\u00a0Python: \u0447\u0438\u0441\u0435\u043b, \u0441\u0442\u0440\u043e\u043a, \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041b\u044e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u00a0Python\u00a0\u2014 \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 <code>PyObject<\/code> (\u0447\u0442\u043e \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e\u00a0\u0432\u0441\u0435 \u0432\u00a0Python \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c).<\/p>\n<pre><code class=\"cpp\">typedef struct _object {    Py_ssize_t ob_refcnt;      \/\/ \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0441\u0441\u044b\u043b\u043e\u043a    struct _typeobject *ob_type; \/\/ \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0438\u043f} PyObject;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435, \u043c\u044b:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <code>PyObject*<\/code> \u0438\u0437\u00a0Python<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441\u00a0\u043d\u0438\u043c \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u043a\u0440\u043e\u0441\u044b (<code>PyLong_AsLong<\/code>, <code>PyFloat_AsDouble<\/code> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0435 <code>PyObject*<\/code> \u0434\u043b\u044f\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0445 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432\u00a0Python<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e C\u2011API<\/strong>: \u0437\u0430\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 <code>PyObject<\/code> <em>\u0442\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0448\u044c \u0441\u0430\u043c<\/em>. \u0417\u0430\u0431\u044b\u043b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c <code>refcount<\/code>\u00a0\u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0448\u044c segfault. \u0417\u0430\u0431\u044b\u043b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c\u00a0\u2014 \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438. \u042d\u0442\u043e \u043a\u0430\u043a\u00a0\u0440\u0443\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0432\u00a0\u0441, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f\u00a0python \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041a\u0442\u043e \u043b\u0435\u0437\u0435\u0442 \u043d\u0430\u00a0\u0441\u0442\u043e\u0440\u043e\u043d\u0443 c++ \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0438\u0441\u043a\u0438:)<\/p>\n<hr\/>\n<p>\u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430.<\/p>\n<h3>\u0427\u0430\u0441\u0442\u044c 3. \u041f\u0438\u0448\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c C\u2011API<\/h3>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0443\u00a0\u0436\u0435 <code>sum_of_squares<\/code>, \u043d\u043e\u00a0\u043d\u0430\u00a0C. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <code>fastmath.c<\/code>: <\/p>\n<pre><code class=\"cpp\">#define PY_SSIZE_T_CLEAN#include &lt;Python.h&gt;\/\/ \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044fstatic PyObject* sum_of_squares_c(PyObject* self, PyObject* args) {    PyObject* numbers_list;        \/\/ 1. \u043f\u0430\u0440\u0441\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b: \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a    if (!PyArg_ParseTuple(args, \"O\", &amp;numbers_list)) {        return NULL;  \/\/ NULL = \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 Python    }        \/\/ 2. \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043f\u0438\u0441\u043e\u043a    if (!PyList_Check(numbers_list)) {        PyErr_SetString(PyExc_TypeError, \"Expected a list\");        return NULL;    }        \/\/ 3. \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c    Py_ssize_t n = PyList_Size(numbers_list);    double total = 0.0;        for (Py_ssize_t i = 0; i &lt; n; i++) {        PyObject* item = PyList_GetItem(numbers_list, i);  \/\/ borrowed ref        double value = PyFloat_AsDouble(item);                if (PyErr_Occurred()) {            return NULL;  \/\/ \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 float        }                total += value * value;    }        \/\/ 4. \u0441\u043e\u0437\u0434\u0430\u0451\u043c Python-float \u0434\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430    return PyFloat_FromDouble(total);}\/\/ \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u043e\u0434\u0443\u043b\u044fstatic PyMethodDef FastMathMethods[] = {    {\"sum_of_squares\", sum_of_squares_c, METH_VARARGS,      \"Compute sum of squares of a list of floats\"},    {NULL, NULL, 0, NULL}  \/\/ sentinel};\/\/ \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044fstatic struct PyModuleDef fastmathmodule = {    PyModuleDef_HEAD_INIT,    \"fastmath\",        \/\/ \u0438\u043c\u044f \u043c\u043e\u0434\u0443\u043b\u044f    NULL,              \/\/ docstring    -1,    FastMathMethods};\/\/ \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 - \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044fPyMODINIT_FUNC PyInit_fastmath(void) {    return PyModule_Create(&amp;fastmathmodule);}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<h2>\u0411\u043b\u043e\u043a \u0434\u043b\u044f\u00a0\u043b\u044e\u0434\u0435\u0439 \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435\u00a0\u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0445 \u043d\u0430\u00a0c\u0438<\/h2>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a\u00a0\u043d\u0430\u0431\u043e\u0440 \u0441\u0442\u0440\u043e\u0433\u0438\u0445 \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439. \u0422\u0443\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 api, \u043f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435\u00a0\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0432\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430\u00a0\u0441\u0442\u043e\u0440\u043e\u043d\u0435 python. \u041d\u043e\u00a0\u043e\u043d, \u043a\u0430\u043a\u00a0\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043e\u0447\u0435\u043d\u044c \u0435\u043c\u043a\u0438\u0439 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0421\u043e\u0437\u0434\u0430\u0451\u043c <code>setup.py<\/code>: <\/p>\n<pre><code class=\"python\">from setuptools import setup, Extension# \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0421.# Extension - \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430. \u041a\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043a\u0430\u043a \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.module = Extension(    'fastmath',             # \u0418\u043c\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 (import fastmath)    sources=['fastmath.c']  # \u041f\u0443\u0442\u044c \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u043d\u0430 \u0421)# \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438setup(    name='fastmath',        # \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430    version='1.0',          # \u0412\u0435\u0440\u0441\u0438\u044f    ext_modules=[module]    # \u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u0421-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0431\u043e\u0440\u043a\u0438)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c: <\/p>\n<pre><code class=\"bash\">python setup.py build_ext --inplace<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>fastmath.cpython-311-x86_64-linux-gnu.so<\/code> (\u0438\u043b\u0438 <code>.pyd<\/code> \u043d\u0430\u00a0Windows). \u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u00a0\u043e\u0431\u044b\u0447\u043d\u044b\u0439 Python\u2011\u043f\u0430\u043a\u0435\u0442 (\u043e\u0441 \u0441\u0430\u043c\u0430 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u043a\u0430\u043a\u00a0\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u00a0\u043f\u0440\u0438\u043c\u0435\u0440\u0443 dll): <\/p>\n<pre><code class=\"python\">import fastmathnumbers = [float(i) for i in range(1_000_000)]result = fastmath.sum_of_squares(numbers)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0414\u0430\u0436\u0435 \u043d\u0430\u00a0\u0442\u0430\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0438\u0434\u043d\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430: <\/p>\n<ul>\n<li>\n<p><code>PyArg_ParseTuple<\/code>\u00a0\u2014 \u0440\u0430\u0437\u0431\u043e\u0440 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><code>PyList_Check<\/code>, <code>PyList_Size<\/code>, <code>PyList_GetItem<\/code>\u00a0\u2014 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c<\/p>\n<\/li>\n<li>\n<p><code>PyFloat_AsDouble<\/code>, <code>PyFloat_FromDouble<\/code>\u00a0\u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0442\u0438\u043f\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0420\u0443\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <code>refcount<\/code> (\u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0435\u0433\u043e \u043d\u0435\u00a0\u0442\u0440\u043e\u0433\u0430\u043b\u0438, \u043d\u043e\u00a0\u0432\u0441\u0435\u00a0\u0436\u0435)<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438\u00a0\u0431\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b\u0430 5\u00a0\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u00a0\u0442\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u00a0\u2014 \u043a\u043e\u0434 \u0440\u0430\u0437\u0440\u043e\u0441\u0441\u044f\u00a0\u0431\u044b \u0434\u043e 100+ \u0441\u0442\u0440\u043e\u043a. \u0418 \u044d\u0442\u043e \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c C. <\/p>\n<hr\/>\n<h3>\u0427\u0430\u0441\u0442\u044c 4. Pybind11: \u043f\u0430\u043b\u043e\u0447\u043a\u0430 \u0432\u044b\u0440\u0443\u0447\u0430\u043b\u043e\u0447\u043a\u0430 (\u043d\u0443 \u043f\u043e\u0447\u0442\u0438)<\/h3>\n<p><code>pybind11<\/code>\u00a0\u2014 \u044d\u0442\u043e header\u2011only \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430\u00a0c++ v11, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 python C\u2011API \u0432\u00a0\u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b. \u041e\u043d\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u0432\u0435 \u0432\u0435\u0449\u0438: <\/p>\n<ul>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0442\u0438\u043f\u044b \u043c\u0435\u0436\u0434\u0443 c++ \u0438 python<\/p>\n<\/li>\n<li>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 <code>refcount<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0442 \u0442\u0430\u00a0\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043d\u043e\u00a0\u043d\u0430 <code>pybind11<\/code> (\u0444\u0430\u0439\u043b <code>fastmath_pybind.cpp<\/code>): <\/p>\n<pre><code class=\"cpp\">#include &lt;pybind11\/pybind11.h&gt;#include &lt;pybind11\/stl.h&gt;  \/\/ \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 std::vector#include &lt;vector&gt;double sum_of_squares(const std::vector&lt;double&gt;&amp; numbers) {    double total = 0.0;    for (double n : numbers) {        total += n * n;    }    return total;}namespace py = pybind11;PYBIND11_MODULE(fastmath_pybind, m) {    m.doc() = \"Fast math module\";    m.def(\"sum_of_squares\", &amp;sum_of_squares,           \"Compute sum of squares\",           py::arg(\"numbers\"));}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p><strong>\u0412\u0441\u0435, <\/strong>\u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e. \u042d\u0442\u043e \u0432\u0435\u0441\u044c \u043a\u043e\u0434.<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u0442 <code>PyObject*<\/code><\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 <code>PyArg_ParseTuple<\/code><\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/p>\n<\/li>\n<li>\n<p><code>std::vector&lt;double&gt;<\/code> \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u00a0Python\u2011\u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code>setuptools<\/code> \u0441\u00a0\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c: <\/p>\n<pre><code class=\"cpp\">from setuptools import setupfrom pybind11.setup_helpers import Pybind11Extensionext_modules = [    Pybind11Extension(        \"fastmath_pybind\",        [\"fastmath_pybind.cpp\"],        cxx_std=11,    ),]setup(    name=\"fastmath_pybind\",    version=\"1.0\",    ext_modules=ext_modules,)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<hr\/>\n<h3>\u0427\u0430\u0441\u0442\u044c 5. \u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438<\/h3>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u00a0\u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u0437 10\u00a0\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 <code>float<\/code>. \u041c\u0430\u0448\u0438\u043d\u0430: \u041d\u043e\u0443\u0442\u0431\u0443\u043a HONOR MagicBook 14(\u044f \u0431\u043e\u043c\u0436 \u043b\u043e\u043b, \u0442\u0430\u043a \u0447\u0442\u043e\u00a0\u043d\u0435\u00a0\u0441\u0443\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u0433\u043e), Python 3.11. <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043b NumPy \u0442\u0430\u043a \u043a\u0430\u043a\u00a0\u043e\u043d \u0442\u043e\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430\u00a0c++ \u0441\u00a0\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f\u00a0\u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f (\u0441\u0435\u043a)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0447\u0438\u0441\u0442\u044b\u0439 Python<\/p>\n<\/td>\n<td>\n<p>0.2521<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0447\u0438\u0441\u0442\u044b\u0439 C\u2011API<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0528<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Pybind11(<code>fastmath_pybind<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.1129<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>NumPy (<code>np.sum(arr**2)<\/code>)<\/p>\n<p align=\"left\">\n<\/td>\n<td>\n<p align=\"left\">0.0032<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>\u0427\u0442\u043e\u00a0\u043c\u044b \u0432\u0438\u0434\u0438\u043c:<\/strong> <\/p>\n<p>\u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434: <strong>\u043e\u0432\u0435\u0440\u0445\u0435\u0434 pybind11\u00a0\u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0\u0447\u0438\u0441\u0442\u044b\u043c C\u2011API \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u00a0\u0442\u0435\u043e\u0440\u0438\u0438\u00a0\u2014 \u043d\u0443\u043b\u0435\u0432\u043e\u0439<\/strong>. \u041d\u043e\u00a0\u043d\u0430\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432\u0437\u0430\u043c\u0435\u043d \u043d\u0430\u00a0\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e, \u043c\u044b \u0442\u0435\u0440\u044f\u0435\u043c \u0432\u00a0\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e. (\u0425\u043e\u0442\u044f, \u043c\u043e\u0436\u0435\u0442, \u044d\u0442\u043e \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u0438\u0433\u043e\u0432\u043e \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043b, \u0438\u0431\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c\u00a0\u2014 \u0432\u00a0\u0442\u0435\u043e\u0440\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e \u043f\u043e\u00a0\u0432\u0440\u0435\u043c\u0435\u043d\u0438)<\/p>\n<h3>\u0427\u0430\u0441\u0442\u044c 6. \u041a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0438\u0442, \u0430\u00a0\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u00a0\u0441\u0442\u043e\u0438\u0442 \u043b\u0435\u0437\u0442\u044c \u0432\u00a0\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e (\u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0451\u2011\u0442\u0430\u043a\u0438 \u043a\u043e\u0441\u0442\u044b\u043b\u044c?)<\/h3>\n<p>\u041d\u0435\u00a0\u043a\u0430\u0436\u0434\u043e\u0435 \u0443\u0437\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441++ \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435. \u0412\u043e\u0442 \u043c\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0447\u0435\u043a\u2011\u043b\u0438\u0441\u0442 (\u0442\u0430\u043a\u00a0\u0436\u0435 \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u043e\u00a0\u043f\u043e\u0432\u043e\u0434\u0443 \u0435\u0433\u043e \u0441\u00a0qwen \u0447\u0430\u0442\u043e\u043c):<\/p>\n<p> <strong>\u0421\u0442\u043e\u0438\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u00a0C\/C++:<\/strong> <\/p>\n<ul>\n<li>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0440\u0430\u0437 \u0432\u00a0\u0446\u0438\u043a\u043b\u0435<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0451\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b \u0443\u043f\u0435\u0440\u043b\u0438\u0441\u044c \u0432\u00a0cpu, \u0430\u00a0\u043d\u0435\u00a0\u0432\u00a0I\/O (\u0435\u0441\u043b\u0438 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438\u00a0\u0441\u0435\u0442\u044c\u00a0\u2014 C \u043d\u0435\u00a0\u043f\u043e\u043c\u043e\u0436\u0435\u0442)<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430\u044f C\/C++ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u00a0Python<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041d\u0435\u00a0\u0441\u0442\u043e\u0438\u0442, \u0435\u0441\u043b\u0438:<\/strong> <\/p>\n<ul>\n<li>\n<p>\u0423\u0437\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e\u00a0\u2014 \u044d\u0442\u043e I\/O (\u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u00a0\u0434\u0438\u0441\u043a\u0430). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>asyncio<\/code> \u0438\u043b\u0438\u00a0\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438. O(n\u00b2) \u2192 O(n log n) \u0434\u0430\u0441\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430\u00a0C (\u043d\u043e \u0435\u0441\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c).<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435: NumPy, Cython, Numba. \u0427\u0430\u0441\u0442\u043e <code>@njit<\/code> \u043e\u0442\u00a0Numba \u0434\u0430\u0451\u0442 \u0442\u043e\u0442\u00a0\u0436\u0435 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0431\u0435\u0437\u00a0\u0435\u0434\u0438\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 C\u2011\u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f (MVP \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e\u00a0\u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0439\u0442\u0435. (\u041d\u0443 \u0438\u043b\u0438\u00a0\u0437\u0430\u0431\u0435\u0439\u0442\u0435, \u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u0447\u0442\u043e\u00a0\u0441\u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0443 \u0432\u00a0\u0447\u0435\u0442\u0432\u0435\u0440\u0433, \u043d\u043e\u00a0\u043d\u0435\u00a0\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0435 \u0432\u00a0\u043a\u0430\u043a\u043e\u0439 \ud83d\ude07)<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b, \u043e\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u0437\u043d\u0430\u0442\u044c:<\/strong><\/p>\n<ul>\n<li>\n<p><strong>Cython<\/strong>\u00a0\u2014 \u00abPython \u0441\u00a0\u0442\u0438\u043f\u0430\u043c\u0438\u00bb. \u041f\u0438\u0448\u0435\u0442\u0435 \u043f\u043e\u0447\u0442\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 Python, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 C\u2011\u043a\u043e\u0434. \u041e\u0442\u043b\u0438\u0447\u043d\u043e \u0434\u043b\u044f\u00a0\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041d\u043e\u00a0\u043a\u043e\u0441\u0442\u044b\u043b\u044c:(.<\/p>\n<\/li>\n<li>\n<p><strong>Numba<\/strong>\u00a0\u2014 JIT\u2011\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 <code>@jit<\/code>\u00a0\u2014 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u00a0\u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u00a0\u043b\u0435\u0442\u0443. \u041e\u0447\u0435\u043d\u044c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0442\u0435\u043c\u0430, \u043e\u00a0\u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u00a0\u0431\u043e\u043d\u0443\u0441\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u044f\u0437\u044b\u043a\u043e\u0432 \u0432\u00a0\u0438\u0445 \u0441\u0444\u0435\u0440\u0430\u0445 \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Rust + PyO3<\/strong>\u00a0\u2014 \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u0441\u00a0\u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f\u043c\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438. PyO3\u00a0\u2014 \u044d\u0442\u043e \u00abpybind11\u00a0\u0434\u043b\u044f\u00a0Rust\u00bb. \u041d\u0443 \u043a\u043e\u0440\u043e\u0447\u0435, \u0442\u043e\u0436\u0435 \u043c\u043e\u0437\u0433\u043e\u0432\u044b\u043d\u043e\u0441\u044f\u0448\u043a\u0430, \u043d\u043e\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u00a0\u0442\u0435\u0431\u0435 \u0441\u043f\u0430\u0432\u043d\u044f\u0442\u0441\u044f \u0447\u0443\u043b\u043a\u0438.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h3>\u0411\u043e\u043d\u0443\u0441. \u0410\u00a0\u043c\u043e\u0436\u0435\u0442, \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u00a0\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u00a0C? \u041c\u0430\u0433\u0438\u044f JIT\u2011\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (Numba)<\/h3>\n<p>\u041c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e\u00a0\u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043a\u043e\u0434 \u043d\u0430\u00a0C, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0441 <code>PyObject<\/code>, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u0438 \u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 <code>setup.py<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432 40\u00a0\u0440\u0430\u0437. \u0417\u0432\u0443\u0447\u0438\u0442 \u0441\u043e\u043b\u0438\u0434\u043d\u043e, \u043d\u043e\u00a0\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0447\u0435\u0441\u0442\u043d\u043e: \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c C\u2011\u043a\u043e\u0434 \u0432\u00a0Python\u2011\u043f\u0440\u043e\u0435\u043a\u0442\u0435\u00a0\u2014 \u044d\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0437\u0433\u043e\u0432\u044b\u043d\u043e\u0441\u044f\u0448\u043a\u0430 (\u043a\u0440\u043e\u0441\u0441\u2011\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043f\u043e\u0434\u00a0\u0440\u0430\u0437\u043d\u044b\u0435 \u041e\u0421, segfault&#8217;\u044b, CI\/CD). <\/p>\n<p>\u0410\u00a0\u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u044f \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e\u00a0\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <strong>\u0442\u0435\u00a0\u0436\u0435 \u0441\u0430\u043c\u044b\u0435 40\u00a0x \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f<\/strong>, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432\u00a0\u0441\u0432\u043e\u0439 Python\u2011\u043a\u043e\u0434 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438? \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u0430\u0442\u044c \u043c\u043d\u0435 \u043f\u043e\u00a0\u0433\u043e\u043b\u043e\u0432\u0435 \u0436\u0435\u043b\u0435\u0437\u043d\u043e\u0439 \u043b\u043e\u0436\u043a\u043e\u0439, \u043d\u043e\u00a0\u0442\u0443\u0442 \u0442\u043e\u0436 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u00a0\u043f\u043b\u044e\u0441\u0430\u0445&#8230;<\/p>\n<p>\u0417\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c, <strong>Numba<\/strong>\u00a0\u2014 JIT\u2011\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 (Just\u2011In\u2011Time) \u0434\u043b\u044f\u00a0Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e python \u0438 NumPy \u043a\u043e\u0434\u0430 \u0432\u00a0\u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u00a0\u043b\u0435\u0442\u0443 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 <strong>LLVM<\/strong> (\u0442\u043e\u0433\u043e\u00a0\u0436\u0435 \u0441\u0430\u043c\u043e\u0433\u043e, \u0447\u0442\u043e\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u00a0Clang, Rust \u0438 Swift). <\/p>\n<h4>\u041a\u0430\u043a\u00a0\u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/h4>\n<p>\u0412\u043e\u0437\u044c\u043c\u0451\u043c \u043d\u0430\u0448\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c Python: <\/p>\n<pre><code class=\"python\">from numba import njitimport numpy as np# \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430 Pythondef sum_of_squares_py(numbers):    total = 0.0    for n in numbers:        total += n * n    return total# \u041c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430: \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434sum_of_squares_jit = njit(sum_of_squares_py)# \u0418\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440:@njitdef sum_of_squares_numba(numbers):    total = 0.0    for n in numbers:        total += n * n    return total<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0412\u0441\u0451. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 <code>.c<\/code> \u0444\u0430\u0439\u043b\u043e\u0432, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 <code>PyArg_ParseTuple<\/code>. \u0412\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0435 <code>sum_of_squares_numba([1.0, 2.0, 3.0])<\/code>, \u0438 \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<h4>\u0427\u0442\u043e\u00a0\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0434\u00a0\u043a\u0430\u043f\u043e\u0442\u043e\u043c?<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u00a0\u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u043c <code>@njit<\/code>, Numba \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\n<p><strong>\u0410\u043d\u0430\u043b\u0438\u0437 \u0442\u0438\u043f\u043e\u0432<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f LLVM IR<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong><\/p>\n<\/li>\n<\/ul>\n<h4>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a: C\u2011API vs Numba<\/h4>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u00a0\u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0438\u0437 10\u00a0\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0447\u0438\u0441\u0435\u043b (\u0434\u043b\u044f \u0447\u0438\u0441\u0442\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>numpy.array<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a\u00a0Numba \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u00a0\u043d\u0438\u043c, \u0445\u043e\u0442\u044f \u0441\u043f\u0438\u0441\u043a\u0438 \u0442\u043e\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442) \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u0442\u0435: <\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td>\n<p align=\"left\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0440\u0435\u043c\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">C\u2011API<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0528<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Numba<\/p>\n<\/td>\n<td>\n<p align=\"left\">0.0093<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><em>Ps:Numba \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442 \u0440\u0443\u0447\u043d\u043e\u0439 C\u2011\u043a\u043e\u0434, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0LLVM\u2011\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0443\u043c\u0435\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e (SIMD\u2011\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430), \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u0442.<\/em> <\/p>\n<h4>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438 \u043c\u0438\u043d\u0443\u0441\u044b JIT<\/h4>\n<ul>\n<li>\n<p><strong>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 Python<\/strong>: \u0412\u043d\u0443\u0442\u0440\u0438 <code>@njit<\/code> \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 Python\u2011\u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u0421\u043b\u043e\u0432\u0430\u0440\u0438, \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u043b\u0438\u00a0\u0432\u044b\u0437\u043e\u0432\u044b \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a (\u043a\u0440\u043e\u043c\u0435 NumPy \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445) \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442 \u043a\u00a0\u043e\u0448\u0438\u0431\u043a\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438\u043b\u0438\u00a0fallback&#8217;\u0443 \u0432\u00a0\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c (<code>object mode<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0449\u0451 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0447\u0438\u0441\u0442\u043e\u0433\u043e Python.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0432\u0435\u0440\u0445\u0435\u0434 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/strong>: \u041f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f (\u043e\u0442 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043e\u00a0\u0441\u0435\u043a\u0443\u043d\u0434). \u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0437\u0430\u00a0\u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 <em>\u0437\u0430\u043c\u0435\u0434\u043b\u0435\u043d\u0438\u0435<\/em>. (\u041b\u0435\u0447\u0438\u0442\u0441\u044f \u0444\u043b\u0430\u0433\u043e\u043c <code>@njit(cache=True)<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f<\/strong>: \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u0442\u0435 \u0432\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043f\u0438\u0441\u043e\u043a <code>int<\/code>, \u0430\u00a0\u043f\u043e\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043e\u043a <code>float<\/code>, Numba \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442 <strong>\u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438<\/strong> \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0434\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0442\u0438\u043f\u043e\u0432. \u042d\u0442\u043e \u0435\u0441\u0442 \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u043e\u0433: <strong>\u043e\u0432\u0435\u0440\u0445\u0435\u0434 pybind11\u00a0\u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0\u0447\u0438\u0441\u0442\u044b\u043c C\u2011API\u00a0\u2014 \u043d\u0443\u043b\u0435\u0432\u043e\u0439<\/strong>. \u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e C++ \u0431\u0435\u0437\u00a0\u043f\u043e\u0442\u0435\u0440\u044c \u0432\u00a0\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0410\u00a0Numba \u0432\u00a0\u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442 \u0434\u0430\u0436\u0435 \u0440\u0443\u0447\u043d\u043e\u0439 C\u2011\u043a\u043e\u0434 \u0437\u0430\u00a0\u0441\u0447\u0451\u0442 LLVM\u2011\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 \u0438 SIMD\u2011\u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. <\/p>\n<p>\u041d\u0443\u0436\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438:<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e\u00a0\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e python \u0438 c\u2011api\u00a0\u2014 <a href=\"https:\/\/docs.python.org\/3\/c-api\/?spm=a2ty_o01.29997173.0.0.e3bfc9212Su33v\" rel=\"noopener nofollow\">https:\/\/docs.python.org\/3\/c\u2011api\/?spm=a2ty_o01.29997173.0.0.e3bfc9212Su33v<\/a><\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e\u00a0jit\u00a0\u2014 <a href=\"https:\/\/numba.readthedocs.io\/en\/stable\/?spm=a2ty_o01.29997173.0.0.e3bfc9212Su33v\" rel=\"noopener nofollow\">https:\/\/numba.readthedocs.io\/en\/stable\/?spm=a2ty_o01.29997173.0.0.e3bfc9212Su33v<\/a><\/p>\n<p>Githab \u0441\u0442\u0430\u0442\u044c\u0438 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e (\u0435\u0441\u043b\u0438 404, \u0437\u043d\u0430\u0447\u0438\u0442 \u044f \u0443\u0436\u0435 \u0443\u0434\u0430\u043b\u0438\u043b)\u00a0\u2014 <a href=\"https:\/\/github.com\/stl2802\/Different-types-of-compilations\" rel=\"noopener nofollow\">https:\/\/github.com\/stl2802\/Different\u2011types\u2011of\u2011compilations<\/a><\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1101090\/\">https:\/\/habr.com\/ru\/articles\/1101090\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043f\u0440\u043e\u0447\u0435\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e pyrusmorph\u00a0\u2014 python \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u043d\u0430\u0434 30-\u043b\u0435\u0442\u043d\u0438\u043c \u0441++ \u044f\u0434\u0440\u043e\u043c libmorph\/rus. \u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u0443\u0434\u0438\u0432\u0438\u043b\u0438: \u0432 30\u00a0\u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 PyMorphy3 \u043f\u0440\u0438\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0442\u0435\u043a\u0441\u0442\u0430. \u041f\u043e\u0441\u043b\u0435 \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f. \u041a\u0430\u043a\u00a0\u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043f\u0438\u0448\u0435\u043c import pyrusmorph \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u043d\u0430\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u0441++ \u043a\u043e\u0434\u0443 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u043f\u0440\u044f\u043c\u043e \u0432\u043d\u0443\u0442\u0440\u0438 python.\u0412\u00a0\u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u0440\u043e\u0439\u0442\u0438 \u044d\u0442\u043e\u0442 \u043f\u0443\u0442\u044c \u0441\u00a0\u043d\u0443\u043b\u044f. \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a\u00a0\u0443\u0441\u0442\u0440\u043e\u0435\u043d Python \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb, \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0451 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c C\u2011API, \u0430\u00a0\u043f\u043e\u0442\u043e\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u00a0\u044d\u0442\u0443 \u0431\u043e\u043b\u044c \u043b\u0435\u0447\u0438\u0442 pybind11. \u0412\u00a0\u043a\u043e\u043d\u0446\u0435\u00a0\u2014 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u0441\u0442\u043e\u0438\u0442 \u043b\u0435\u0437\u0442\u044c \u0432\u00a0c++ \u0434\u043b\u044f\u00a0\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438. \u0411\u043e\u043d\u0443\u0441\u00a0\u2014 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u00a0\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435 python \u043a\u043e\u0434\u0430 (JIT\u2011\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440)\u0427\u0430\u0441\u0442\u044c 1. \u041f\u043e\u0447\u0435\u043c\u0443 Python \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439? \u0410\u043d\u0430\u0442\u043e\u043c\u0438\u044f PyObject\u0421\u00a0\u043d\u0430\u0447\u0430\u043b\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e\u00a0\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442. \u0412\u043e\u0437\u044c\u043c\u0451\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443: \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0434\u043b\u044f\u00a0\u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u0437\u00a0\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0447\u0438\u0441\u0435\u043b. def sum_of_squares_py(numbers):    total = 0.0    for n in numbers:        total += n * n    return total\u041a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u041d\u043e\u00a0\u0447\u0442\u043e\u00a0\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u00a0\u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435 \u0446\u0438\u043a\u043b\u0430? \u041a\u0430\u0436\u0434\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u00a0Python\u00a0\u2014 \u044d\u0442\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 PyObject \u0432\u00a0\u043a\u0443\u0447\u0435. \u0423\u00a0\u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c: \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a\u00a0\u2014 16\u00a0\u0431\u0430\u0439\u0442\u0421\u0430\u043c\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00a0\u2014 8\u00a0\u0431\u0430\u0439\u0442 (float)\u041e\u0432\u0435\u0440\u0445\u0435\u0434 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430 \u043f\u0430\u043c\u044f\u0442\u0438\u00a0\u2014 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 (\u0433\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u043c\u0435\u0442\u0430\u2011\u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430)\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0438\u0448\u0435\u043c n * n, Python \u0434\u043e\u043b\u0436\u0435\u043d: \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432\u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f float\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 float \u0432\u00a0\u043a\u0443\u0447\u0435 \u0434\u043b\u044f\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0423\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c refcount, \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 total += &#8230;\u0423\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c refcount \u0443\u00a0\u0441\u0442\u0430\u0440\u043e\u0433\u043e total\u0412\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430(\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430, \u043d\u043e\u00a0\u0432\u0441\u0435\u00a0\u0436\u0435)\u041d\u0430\u00a0\u043e\u0434\u0438\u043d \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439\u00a0\u2014 \u044d\u0442\u043e \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u0442\u0438\u043f\u043e\u0432. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 python \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439. \u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0434\u0435\u043b\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043b\u0438\u0448\u043d\u0435\u0439.\u0412\u00a0c\u0438\u2011\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0442\u0430\u00a0\u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u00a0\u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 mulsd \u043d\u0430\u0434 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c\u0438. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0439, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a. \u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0442\u0430\u043a \u043a\u0430\u043a\u00a0c\u0438 \u0431\u043e\u043b\u0435\u0435 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u044f\u0437\u044b\u043a, \u043d\u0435\u00a0\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u0432\u00a0\u0441\u043a\u0440\u0438\u043f\u0442\u0430\u0445 (\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440) \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u043c\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438\u0427\u0430\u0441\u0442\u044c 2. Python C\u2011API: \u043a\u0430\u043a\u00a0\u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043d\u0430\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435Python (\u0435\u0433\u043e \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f CPython) \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430\u00a0\u0441. \u0423\u00a0\u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c C\u2011API\u00a0\u2014 \u043d\u0430\u0431\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 c\u2011\u043a\u043e\u0434\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u00a0python \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0442\u0430\u043a\u00a0\u0436\u0435, \u043a\u0430\u043a\u00a0\u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440. \u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u00a0\u2014 PyObject. \u042d\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f\u00a0\u0432\u0441\u0435\u0433\u043e \u0432\u00a0Python: \u0447\u0438\u0441\u0435\u043b, \u0441\u0442\u0440\u043e\u043a, \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041b\u044e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u00a0Python\u00a0\u2014 \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 PyObject (\u0447\u0442\u043e \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e\u00a0\u0432\u0441\u0435 \u0432\u00a0Python \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c).typedef struct _object {    Py_ssize_t ob_refcnt;      \/\/ \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0441\u0441\u044b\u043b\u043e\u043a    struct _typeobject *ob_type; \/\/ \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0442\u0438\u043f} PyObject;\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u0438\u0448\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435, \u043c\u044b:\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c PyObject* \u0438\u0437\u00a0Python\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441\u00a0\u043d\u0438\u043c \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u043a\u0440\u043e\u0441\u044b (PyLong_AsLong, PyFloat_AsDouble \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435)\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0435 PyObject* \u0434\u043b\u044f\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0445 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432\u00a0Python\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e C\u2011API: \u0437\u0430\u00a0\u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 PyObject \u0442\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0448\u044c \u0441\u0430\u043c. \u0417\u0430\u0431\u044b\u043b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c refcount\u00a0\u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0448\u044c segfault. \u0417\u0430\u0431\u044b\u043b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c\u00a0\u2014 \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438. \u042d\u0442\u043e \u043a\u0430\u043a\u00a0\u0440\u0443\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0432\u00a0\u0441, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f\u00a0python \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041a\u0442\u043e \u043b\u0435\u0437\u0435\u0442 \u043d\u0430\u00a0\u0441\u0442\u043e\u0440\u043e\u043d\u0443 c++ \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0438\u0441\u043a\u0438:)\u041d\u0443 \u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430.\u0427\u0430\u0441\u0442\u044c 3. \u041f\u0438\u0448\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c C\u2011API\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0443\u00a0\u0436\u0435 sum_of_squares, \u043d\u043e\u00a0\u043d\u0430\u00a0C. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b fastmath.c: #define PY_SSIZE_T_CLEAN#include &lt;Python.h&gt;\/\/ \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044fstatic PyObject* sum_of_squares_c(PyObject* self, PyObject* args) {    PyObject* numbers_list;        \/\/ 1. \u043f\u0430\u0440\u0441\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b: \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a    if (!PyArg_ParseTuple(args, &#171;O&#187;, &amp;numbers_list)) {        return NULL;  \/\/ NULL = \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432 Python    }        \/\/ 2. \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043f\u0438\u0441\u043e\u043a    if (!PyList_Check(numbers_list)) {        PyErr_SetString(PyExc_TypeError, &#171;Expected a list&#187;);        return NULL;    }        \/\/ 3. \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u043f\u043e \u0441\u043f\u0438\u0441\u043a\u0443 \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c    Py_ssize_t n = PyList_Size(numbers_list);    double total = 0.0;        for (Py_ssize_t i = 0; i &lt; n; i++) {        PyObject* item = PyList_GetItem(numbers_list, i);  \/\/ borrowed ref        double value = PyFloat_AsDouble(item);                if (PyErr_Occurred()) {            return NULL;  \/\/ \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 float        }                total += value * value;    }        \/\/ 4. \u0441\u043e\u0437\u0434\u0430\u0451\u043c Python-float \u0434\u043b\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430    return PyFloat_FromDouble(total);}\/\/ \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043c\u043e\u0434\u0443\u043b\u044fstatic PyMethodDef FastMathMethods[] = {    {&#171;sum_of_squares&#187;, sum_of_squares_c, METH_VARARGS,      &#171;Compute sum of squares of a list of floats&#187;},    {NULL, NULL, 0, NULL}  \/\/ sentinel};\/\/ \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044fstatic struct PyModuleDef fastmathmodule = {    PyModuleDef_HEAD_INIT,    &#171;fastmath&#187;,        \/\/ \u0438\u043c\u044f \u043c\u043e\u0434\u0443\u043b\u044f    NULL,              \/\/ docstring    -1,    FastMathMethods};\/\/ \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044fPyMODINIT_FUNC PyInit_fastmath(void) {    return PyModule_Create(&amp;fastmathmodule);}\u0411\u043b\u043e\u043a \u0434\u043b\u044f\u00a0\u043b\u044e\u0434\u0435\u0439 \u043d\u0438 \u0440\u0430\u0437\u0443 \u043d\u0435\u00a0\u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0445 \u043d\u0430\u00a0c\u0438\u041a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a\u00a0\u043d\u0430\u0431\u043e\u0440 \u0441\u0442\u0440\u043e\u0433\u0438\u0445 \u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439. \u0422\u0443\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 api, \u043f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435\u00a0\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0432\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0430\u00a0\u0441\u0442\u043e\u0440\u043e\u043d\u0435 python. \u041d\u043e\u00a0\u043e\u043d, \u043a\u0430\u043a\u00a0\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u043e\u0447\u0435\u043d\u044c \u0435\u043c\u043a\u0438\u0439 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439.\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0421\u043e\u0437\u0434\u0430\u0451\u043c setup.py: from setuptools import setup, Extension# \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u0421.# Extension &#8212; \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430. \u041a\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043a\u0430\u043a \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.module = Extension(    &#8216;fastmath&#8217;,             # \u0418\u043c\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 (import fastmath)    sources=[&#8216;fastmath.c&#8217;]  # \u041f\u0443\u0442\u044c \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u043d\u0430 \u0421)# \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0431\u043e\u0440\u043a\u0438setup(    name=&#8217;fastmath&#8217;,        # \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430    version=&#8217;1.0&#8242;,          # \u0412\u0435\u0440\u0441\u0438\u044f    ext_modules=[module]    # \u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u0421-\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441\u0431\u043e\u0440\u043a\u0438)\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c: python setup.py build_ext &#8212;inplace\u0418 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0444\u0430\u0439\u043b fastmath.cpython-311-x86_64-linux-gnu.so (\u0438\u043b\u0438 .pyd \u043d\u0430\u00a0Windows). \u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u00a0\u043e\u0431\u044b\u0447\u043d\u044b\u0439 Python\u2011\u043f\u0430\u043a\u0435\u0442 (\u043e\u0441 \u0441\u0430\u043c\u0430 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e \u043a\u0430\u043a\u00a0\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u00a0\u043f\u0440\u0438\u043c\u0435\u0440\u0443 dll): import fastmathnumbers = [float(i) for i in range(1_000_000)]result = fastmath.sum_of_squares(numbers)\u0414\u0430\u0436\u0435 \u043d\u0430\u00a0\u0442\u0430\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0438\u0434\u043d\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430: PyArg_ParseTuple\u00a0\u2014 \u0440\u0430\u0437\u0431\u043e\u0440 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432PyList_Check, PyList_Size, PyList_GetItem\u00a0\u2014 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043cPyFloat_AsDouble, PyFloat_FromDouble\u00a0\u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0442\u0438\u043f\u043e\u0432\u0420\u0443\u0447\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 refcount (\u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0435\u0433\u043e \u043d\u0435\u00a0\u0442\u0440\u043e\u0433\u0430\u043b\u0438, \u043d\u043e\u00a0\u0432\u0441\u0435\u00a0\u0436\u0435)\u0415\u0441\u043b\u0438\u00a0\u0431\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b\u0430 5\u00a0\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u00a0\u0442\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u00a0\u2014 \u043a\u043e\u0434 \u0440\u0430\u0437\u0440\u043e\u0441\u0441\u044f\u00a0\u0431\u044b \u0434\u043e 100+ \u0441\u0442\u0440\u043e\u043a. \u0418 \u044d\u0442\u043e \u043d\u0430\u00a0\u0447\u0438\u0441\u0442\u043e\u043c C. \u0427\u0430\u0441\u0442\u044c 4. Pybind11: \u043f\u0430\u043b\u043e\u0447\u043a\u0430 \u0432\u044b\u0440\u0443\u0447\u0430\u043b\u043e\u0447\u043a\u0430 (\u043d\u0443 \u043f\u043e\u0447\u0442\u0438)pybind11\u00a0\u2014 \u044d\u0442\u043e header\u2011only \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430\u00a0c++ v11, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 python C\u2011API \u0432\u00a0\u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b. \u041e\u043d\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u0432\u0435 \u0432\u0435\u0449\u0438: \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0442\u0438\u043f\u044b \u043c\u0435\u0436\u0434\u0443 c++ \u0438 python\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 refcount\u0412\u043e\u0442 \u0442\u0430\u00a0\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043d\u043e\u00a0\u043d\u0430 pybind11 (\u0444\u0430\u0439\u043b fastmath_pybind.cpp): #include &lt;pybind11\/pybind11.h&gt;#include &lt;pybind11\/stl.h&gt;  \/\/ \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 std::vector#include &lt;vector&gt;double sum_of_squares(const std::vector&lt;double&gt;&amp; numbers) {    double total = 0.0;    for (double n : numbers) {        total += n * n;    }    return total;}namespace py = pybind11;PYBIND11_MODULE(fastmath_pybind, m) {    m.doc() = &#171;Fast math module&#187;;    m.def(&#171;sum_of_squares&#187;, &amp;sum_of_squares,           &#171;Compute sum of squares&#187;,           py::arg(&#171;numbers&#187;));}\u0412\u0441\u0435, \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e. \u042d\u0442\u043e \u0432\u0435\u0441\u044c \u043a\u043e\u0434.\u041d\u0435\u0442 PyObject*\u041d\u0435\u0442 PyArg_ParseTuple\u041d\u0435\u0442 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044estd::vector&lt;double&gt; \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u00a0Python\u2011\u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 setuptools \u0441\u00a0\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c: from setuptools import setupfrom pybind11.setup_helpers import Pybind11Extensionext_modules = [    Pybind11Extension(        &#171;fastmath_pybind&#187;,        [&#171;fastmath_pybind.cpp&#187;],        cxx_std=11,    ),]setup(    name=&#187;fastmath_pybind&#187;,    version=&#187;1.0&#8243;,    ext_modules=ext_modules,)\u0427\u0430\u0441\u0442\u044c 5. \u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u00a0\u0441\u043f\u0438\u0441\u043a\u0435 \u0438\u0437 10\u00a0\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 float. \u041c\u0430\u0448\u0438\u043d\u0430: \u041d\u043e\u0443\u0442\u0431\u0443\u043a HONOR MagicBook 14(\u044f \u0431\u043e\u043c\u0436 \u043b\u043e\u043b, \u0442\u0430\u043a \u0447\u0442\u043e\u00a0\u043d\u0435\u00a0\u0441\u0443\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u0433\u043e), Python 3.11. \u0414\u043e\u0431\u0430\u0432\u0438\u043b NumPy \u0442\u0430\u043a \u043a\u0430\u043a\u00a0\u043e\u043d \u0442\u043e\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430\u00a0c++ \u0441\u00a0\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f\u00a0\u0440\u0430\u0431\u043e\u0442\u044b \u0441\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043e\u043c.\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0412\u0440\u0435\u043c\u044f (\u0441\u0435\u043a)\u0447\u0438\u0441\u0442\u044b\u0439 Python0.2521\u0447\u0438\u0441\u0442\u044b\u0439 C\u2011API0.0528Pybind11(fastmath_pybind)0.1129NumPy (np.sum(arr**2))0.0032\u0427\u0442\u043e\u00a0\u043c\u044b \u0432\u0438\u0434\u0438\u043c: \u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434: \u043e\u0432\u0435\u0440\u0445\u0435\u0434 pybind11\u00a0\u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0\u0447\u0438\u0441\u0442\u044b\u043c C\u2011API \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u00a0\u0442\u0435\u043e\u0440\u0438\u0438\u00a0\u2014 \u043d\u0443\u043b\u0435\u0432\u043e\u0439. \u041d\u043e\u00a0\u043d\u0430\u00a0\u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0432\u0437\u0430\u043c\u0435\u043d \u043d\u0430\u00a0\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e, \u043c\u044b \u0442\u0435\u0440\u044f\u0435\u043c \u0432\u00a0\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e. (\u0425\u043e\u0442\u044f, \u043c\u043e\u0436\u0435\u0442, \u044d\u0442\u043e \u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u0438\u0433\u043e\u0432\u043e \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043b, \u0438\u0431\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c\u00a0\u2014 \u0432\u00a0\u0442\u0435\u043e\u0440\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e \u043f\u043e\u00a0\u0432\u0440\u0435\u043c\u0435\u043d\u0438)\u0427\u0430\u0441\u0442\u044c 6. \u041a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0438\u0442, \u0430\u00a0\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u00a0\u0441\u0442\u043e\u0438\u0442 \u043b\u0435\u0437\u0442\u044c \u0432\u00a0\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e (\u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0451\u2011\u0442\u0430\u043a\u0438 \u043a\u043e\u0441\u0442\u044b\u043b\u044c?)\u041d\u0435\u00a0\u043a\u0430\u0436\u0434\u043e\u0435 \u0443\u0437\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441++ \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435. \u0412\u043e\u0442 \u043c\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0447\u0435\u043a\u2011\u043b\u0438\u0441\u0442 (\u0442\u0430\u043a\u00a0\u0436\u0435 \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u043e\u00a0\u043f\u043e\u0432\u043e\u0434\u0443 \u0435\u0433\u043e \u0441\u00a0qwen \u0447\u0430\u0442\u043e\u043c): \u0421\u0442\u043e\u0438\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u00a0C\/C++: \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0440\u0430\u0437 \u0432\u00a0\u0446\u0438\u043a\u043b\u0435\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0451\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445\u0412\u044b \u0443\u043f\u0435\u0440\u043b\u0438\u0441\u044c \u0432\u00a0cpu, \u0430\u00a0\u043d\u0435\u00a0\u0432\u00a0I\/O (\u0435\u0441\u043b\u0438 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438\u00a0\u0441\u0435\u0442\u044c\u00a0\u2014 C \u043d\u0435\u00a0\u043f\u043e\u043c\u043e\u0436\u0435\u0442)\u0415\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u0430\u044f C\/C++ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u00a0Python\u041d\u0435\u00a0\u0441\u0442\u043e\u0438\u0442, \u0435\u0441\u043b\u0438: \u0423\u0437\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e\u00a0\u2014 \u044d\u0442\u043e I\/O (\u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u00a0\u0434\u0438\u0441\u043a\u0430). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 asyncio \u0438\u043b\u0438\u00a0\u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c.\u041c\u043e\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u0438. O(n\u00b2) \u2192 O(n log n) \u0434\u0430\u0441\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430\u00a0C (\u043d\u043e \u0435\u0441\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0447\u044c).\u0415\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435: NumPy, Cython, Numba. \u0427\u0430\u0441\u0442\u043e @njit \u043e\u0442\u00a0Numba \u0434\u0430\u0451\u0442 \u0442\u043e\u0442\u00a0\u0436\u0435 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0431\u0435\u0437\u00a0\u0435\u0434\u0438\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 C\u2011\u043a\u043e\u0434\u0430.\u0412\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f (MVP \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f). \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e\u00a0\u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0439\u0442\u0435. (\u041d\u0443 \u0438\u043b\u0438\u00a0\u0437\u0430\u0431\u0435\u0439\u0442\u0435, \u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u0447\u0442\u043e\u00a0\u0441\u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0443 \u0432\u00a0\u0447\u0435\u0442\u0432\u0435\u0440\u0433, \u043d\u043e\u00a0\u043d\u0435\u00a0\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0435 \u0432\u00a0\u043a\u0430\u043a\u043e\u0439 \ud83d\ude07)\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b, \u043e\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u0437\u043d\u0430\u0442\u044c:Cython\u00a0\u2014 \u00abPython \u0441\u00a0\u0442\u0438\u043f\u0430\u043c\u0438\u00bb. \u041f\u0438\u0448\u0435\u0442\u0435 \u043f\u043e\u0447\u0442\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 Python, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 C\u2011\u043a\u043e\u0434. \u041e\u0442\u043b\u0438\u0447\u043d\u043e \u0434\u043b\u044f\u00a0\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041d\u043e\u00a0\u043a\u043e\u0441\u0442\u044b\u043b\u044c:(.Numba\u00a0\u2014 JIT\u2011\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 @jit\u00a0\u2014 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u00a0\u043c\u0430\u0448\u0438\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u00a0\u043b\u0435\u0442\u0443. \u041e\u0447\u0435\u043d\u044c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0442\u0435\u043c\u0430, \u043e\u00a0\u043d\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u00a0\u0431\u043e\u043d\u0443\u0441\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f, \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u044f\u0437\u044b\u043a\u043e\u0432 \u0432\u00a0\u0438\u0445 \u0441\u0444\u0435\u0440\u0430\u0445 \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.Rust + PyO3\u00a0\u2014 \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u0441\u00a0\u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f\u043c\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438. PyO3\u00a0\u2014 \u044d\u0442\u043e \u00abpybind11\u00a0\u0434\u043b\u044f\u00a0Rust\u00bb. \u041d\u0443&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-500829","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/500829","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=500829"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/500829\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=500829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=500829"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=500829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}