{"id":395150,"date":"2024-06-29T12:03:07","date_gmt":"2024-06-29T12:03:07","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=395150"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=395150","title":{"rendered":"<span>Node.js: Heroes of Worker Threads \u2015 C++ Addon<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/41c\/a88\/25a\/41ca8825af6806a6fa7984a1c412f425.png\" width=\"1120\" height=\"692\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/41c\/a88\/25a\/41ca8825af6806a6fa7984a1c412f425.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u042d\u043f\u0438\u0433\u0440\u0430\u0444<\/h2>\n<p>\u041d\u0438 \u043e\u0434\u0438\u043d \u0434\u0440\u0430\u043a\u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u0441\u0442\u043e\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u0433\u0430\u0434\u043a\u0430\u043c\u0438 \u0438 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0434\u043b\u044f \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u2015<em> <\/em><strong><em>\u0414\u0436.\u0420.\u0420. \u0422\u043e\u043b\u043a\u0438\u043d<\/em><\/strong><\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044c \u043f\u0443\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c JavaScript \u2015 CPU-bound \u0437\u0430\u0434\u0430\u043d\u0438\u0439. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u044b \u044d\u0442\u043e \u0432 2 \u0447\u0430\u0441\u0442\u044f\u0445. \u0412 \u0447\u0430\u0441\u0442\u0438 I \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e CPU-bound \u0437\u0430\u0434\u0430\u043d\u0438\u0439. \u0412 \u0447\u0430\u0441\u0442\u0438 II \u2015 \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f frontend, CPU+I\/O-bound \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435.<\/p>\n<h2>\u0427\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c?<\/h2>\n<p>Node.js \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f CPU intensive \u0437\u0430\u0434\u0430\u043d\u0438\u0439:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c CPU-bound \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044f event loop. \u041a\u0442\u043e-\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0431\u044b\u043b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442. \u041f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u0443 \u0432\u0441\u0435\u0445 \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u044f\u0434\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/child_process.html\" rel=\"noopener noreferrer nofollow\"><u>Child Processes<\/u><\/a>), \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/cluster.html\" rel=\"noopener noreferrer nofollow\"> <u>cluster<\/u><\/a> \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u043d\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/worker_threads.html\" rel=\"noopener noreferrer nofollow\"> <u>Worker Threads<\/u><\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/addons.html\" rel=\"noopener noreferrer nofollow\"> <u>C++ Addon<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 CPU-bound \u0437\u0430\u0434\u0430\u043d\u0438\u044f. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u0434\u0443\u043c\u0430\u044e \u0432\u0441\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u0441\u0442\u0430\u0440\u0438\u043d\u043d\u044b\u0435 \u043b\u0435\u0433\u0435\u043d\u0434\u044b \u043f\u0440\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u201c\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f\u201d \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2015 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0441\u043f\u0435\u0445 (\u043d\u0430 \u044d\u0442\u043e\u0439 \u0444\u0440\u0430\u0437\u0435 \u0433\u0434\u0435-\u0442\u043e \u0432 \u043c\u0438\u0440\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u043b\u0430\u043a\u0430\u0442\u044c React Native \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0445 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0432\u0441\u0435 \u0443\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<h2>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/h2>\n<p>\u041a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440 CPU-bound \u0437\u0430\u0434\u0430\u0447 \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0435 \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0442\u0430\u043d\u0443\u0442 \u201c\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f\u201d \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0432\u0435\u0440\u0441\u0438\u044f, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c JavaScript. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u0434 \u0431\u0443\u0434\u0435 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438: 8-\u044f\u0434\u0435\u0440\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel\u00ae Core\u2122 i7\u20137700HQ @ 2,80 \u0413\u0413\u0446<\/p>\n<h2>\u0411\u0443\u0434\u0435\u0442 \u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432\u0435\u0441\u0435\u043b\u043e\u0435?<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u2015 \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u0434\u0435\u044e, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u2026<\/p>\n<p>\u0418 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f, \u043a\u0440\u0443\u0442\u0430\u044f \u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0430\u044f \u0438\u0433\u0440\u0430\u2026\u00a0 1999-\u0433\u043e \u0433\u043e\u0434\u0430 \u2015 <strong>Heroes of Might and Magic III<\/strong><\/p>\n<h2>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043a\u0443\u043d\u0435\u043c\u0441\u044f \u0432 \u043b\u0435\u0433\u0435\u043d\u0434\u0443<\/h2>\n<p>\u041d\u0430\u0448 \u0433\u0435\u0440\u043e\u0439 \u2015 Node.js \u0438 \u043a\u0430\u043a \u0443 \u043b\u044e\u0431\u043e\u0433\u043e \u0433\u0435\u0440\u043e\u044f, \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0443\u0442\u044c. \u041d\u0430\u0448 \u0433\u0435\u0440\u043e\u0439 \u043a\u0440\u0435\u043f\u043e\u043a \u0438 \u043c\u043e\u0433\u0443\u0447. \u0423\u0436\u0435 \u043f\u043e\u0431\u0435\u0434\u0438\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0430\u0433\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0441\u0430\u043c\u044b\u043c \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u043c \u0432\u0440\u0430\u0433\u043e\u043c \u2015 CPU-bound \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438.<\/p>\n<h2>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 Node.js<\/h2>\n<p>\u041d\u0430\u0448 \u0433\u0435\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0442\u0430\u043a \u043a\u043e\u0433\u043e \u043e\u043d \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u0441 \u0441\u043e\u0431\u043e\u0439?<\/p>\n<p>Cluster \u2015 \u044d\u0442\u043e 7 \u0447\u0435\u0440\u043d\u044b\u0445 \u0434\u0440\u0430\u043a\u043e\u043d\u043e\u0432, 7 Child Processes \u2015 7 \u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u0434\u0440\u0430\u043a\u043e\u043d\u043e\u0432 \u0442\u0430 1 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0434\u0440\u0430\u043a\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 JS, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0437\u0432\u0435\u0440\u0433\u0430\u0435\u0442 \u043d\u0430 \u0432\u0440\u0430\u0433\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u0443\u044e \u043e\u0433\u043d\u044f.<\/p>\n<p>7 Worker Threads \u2015 7 \u043c\u043e\u043b\u043e\u0434\u044b\u0445 \u0437\u0435\u043b\u0435\u043d\u044b\u0445 \u0434\u0440\u0430\u043a\u043e\u043d\u0430. \u041d\u0435\u043e\u043f\u044b\u0442\u043d\u044b\u0445, \u043d\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a \u0431\u043e\u0440\u044c\u0431\u0435.<\/p>\n<p>1 C++ Addon \u2015 1 \u0430\u0440\u0445\u0430\u043d\u0433\u0435\u043b. \u041e\u043f\u044b\u0442\u043d\u044b\u0439 \u0432\u043e\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435\u0445 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 \u0441\u0432\u043e\u0435\u0439 \u0441\u0438\u043b\u044b, \u043d\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0432\u0448\u0438\u0439 \u0441\u0435\u0431\u044f \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6e4\/ca0\/2bb\/6e4ca02bb3d28f09e8c8a45ffdf1a3ce.png\" width=\"1114\" height=\"366\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6e4\/ca0\/2bb\/6e4ca02bb3d28f09e8c8a45ffdf1a3ce.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0427\u0430\u0441\u0442\u044c \u0406<\/h2>\n<p><strong>\u041f\u0435\u0440\u0432\u0430\u044f \u0431\u0438\u0442\u0432\u0430<\/strong><\/p>\n<p>\u0418 \u043f\u0435\u0440\u0432\u043e\u0435 \u0437\u043b\u043e \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043f\u0443\u0442\u0438 \u044d\u0442\u043e 1,400,000 \u0441\u0442\u0440\u043e\u043a (\u0441\u043a\u0435\u043b\u0435\u0442\u043d\u0430\u044f \u043f\u0435\u0445\u043e\u0442\u0430), \u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0438\u0445 \u043f\u043e\u0431\u043e\u0440\u043e\u0442\u044c \u2015 \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0438\u0445 \u0447\u0435\u0440\u0435\u0437<a href=\"https:\/\/en.wikipedia.org\/wiki\/MurmurHash\" rel=\"noopener noreferrer nofollow\"> <u>Murmurhash<\/u><\/a> (\u043d\u0435 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f) \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c<a href=\"https:\/\/www.npmjs.com\/package\/murmurhash3js\" rel=\"noopener noreferrer nofollow\"> <u>murmurhash3js<\/u><\/a> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d, \u043a\u0430\u043a \u0447\u0438\u0441\u0442\u0430\u044f js \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438<a href=\"https:\/\/www.npmjs.com\/package\/murmurhash-native\" rel=\"noopener noreferrer nofollow\"> <u>murmurhash-native<\/u><\/a> \u043a\u0430\u043a \u201c\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f\u201d.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4ab\/cea\/ad4\/4abceaad484a02b13ec7d261f6361232.png\" width=\"800\" height=\"263\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4ab\/cea\/ad4\/4abceaad484a02b13ec7d261f6361232.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (JS 1 \u043f\u0440\u043e\u0446\u0435\u0441\u0441) \u2015 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0446\u0438\u043a\u043b\u0435 \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435:<\/p>\n<pre><code class=\"javascript\">const murmurHash3 = require('murmurhash3js'); ... const hash128x64JS = () => {   ...   const beforeAll = microseconds.now();   for (let i = 0; i &lt; 1400000; i++) {     const hash = murmurHash3.x64.hash128(file[i]);   }   const afterAll = beforeAll + microseconds.since(beforeAll);   ... };<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (Child Processes) \u2015 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u043c (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/child_process.html#child_processspawncommand-args-options\" rel=\"noopener noreferrer nofollow\"><u>spawn<\/u><\/a>) \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0436\u0434\u0435\u043c \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u043e\u0432 (\u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u201cclose\u201d):<\/p>\n<pre><code class=\"javascript\">... let beforeJS; let afterJS; ... const hash128x64JSChildProcess = (i) => new Promise((resolve, reject) => {   const hash128x64JSChildProcess = spawn('node',     ['.\/runners\/murmurhash\/runChildProcess\/hash128x64JSChildProcess.js', i]);   ...   hash128x64JSChildProcess.stdout.on('close', () => {     ...     if (...) afterJS = beforeJS + microseconds.since(beforeJS);     resolve();   }); }); beforeJS = microseconds.now(); await Promise.all([   hash128x64JSChildProcess(0),   hash128x64JSChildProcess(1),   hash128x64JSChildProcess(2),   hash128x64JSChildProcess(3),   hash128x64JSChildProcess(4),   hash128x64JSChildProcess(5),   hash128x64JSChildProcess(6) ]); ...<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (Cluster) \u2015 \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u043b\u044f\u0435\u043c (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/cluster.html#clusterforkenv\" rel=\"noopener noreferrer nofollow\"><u>fork<\/u><\/a>) \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u044f\u0434\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430) \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438 \u0436\u0434\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/cluster.html#event-message\" rel=\"noopener noreferrer nofollow\"><u>messages<\/u><\/a>) \u043e\u0442 \u043d\u0438\u0445 (\u043f\u0440\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b) \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f\u043a \u201c\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u201d \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<pre><code class=\"javascript\">... const workers = [];  const masterProcess = () => new Promise((resolve, reject) => {   ...   let start = 0;   for (let i = 0; i &lt; 8; i++) {     const worker = cluster.fork();     workers.push(worker);      worker.on('message', (message) => {       ...       if (...) resolve(microseconds.since(start));     });   }    start = microseconds.now();   workers[0].send({ processNumber: 0 });   workers[1].send({ processNumber: 1 });   workers[2].send({ processNumber: 2 });   workers[3].send({ processNumber: 3 });   workers[4].send({ processNumber: 4 });   workers[5].send({ processNumber: 5 });   workers[6].send({ processNumber: 6 }); });  const childProcess = () => {   process.on('message', (message) => {     hash128x64JSCluster(message.processNumber);     process.send({ processNumber: message.processNumber });   }); }; ...<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (Worker Threads) \u2015 \u043f\u043e\u0447\u0442\u0438 \u0442\u0430 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0443 \u201ccluster\u201d \u2015 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/worker_threads.html#new-workerfilename-options\" rel=\"noopener noreferrer nofollow\"><u>workers<\/u><\/a>) \u0438 \u0436\u0434\u0435\u043c \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/worker_threads.html#workerismainthread\" rel=\"noopener noreferrer nofollow\"><u>main thread<\/u><\/a>) \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/worker_threads.html#event-message\" rel=\"noopener noreferrer nofollow\"><u>message<\/u><\/a>) \u043e\u0431 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<pre><code class=\"javascript\">... const threads = [];  const mainThread = () => new Promise((resolve, reject) => {   ...   const start = microseconds.now();   threads.push(new Worker(__filename, { workerData: { processNumber: 0 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 1 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 2 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 3 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 4 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 5 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 6 } }));    for (let worker of threads) {     ...     worker.on('message', (msg) => {       ...       if (...) resolve(microseconds.since(start));     });   } }); ...<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (C++ Addon) \u2015 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c C++ Addon (\u043c\u043e\u0434\u0443\u043b\u044c) \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 (\u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043a\u0430\u043a \u0432 JS \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438):<\/p>\n<pre><code class=\"javascript\">const { murmurHash128x64 } = require('murmurhash-native'); ... const hash128x64C = () => {   ...   const beforeAll = microseconds.now();   for (let i = 0; i &lt; 1400000; i++) {     const hash = murmurHash128x64(file[i]);   }   const afterAll = beforeAll + microseconds.since(beforeAll);   ... };<\/code><\/pre>\n<p>\u2026and \u201cAction!\u201d<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ac4\/1d4\/fd5\/ac41d4fd5b610a374737cafd16f8bb00.gif\" width=\"1295\" height=\"669\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ac4\/1d4\/fd5\/ac41d4fd5b610a374737cafd16f8bb00.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0435\u0440\u0432\u043e\u0439 \u0431\u0438\u0442\u0432\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/08c\/767\/03d\/08c76703dcb32af441522f2fd63a5a37.png\" width=\"800\" height=\"683\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/08c\/767\/03d\/08c76703dcb32af441522f2fd63a5a37.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, C++ Addon \u2015 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. Child Processes\/Cluster\/Worker Threads \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p><strong>\u0412\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0443\u043d\u0434<\/strong><\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u043b\u043e \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043f\u0443\u0442\u0438 \u2015 \u044d\u0442\u043e 140 \u0441\u0442\u0440\u043e\u043a (\u0441\u043a\u0435\u043b\u0435\u0442\u043d\u044b\u0435 \u0434\u0440\u0430\u043a\u043e\u043d\u044b) \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u044c \u0438\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e<a href=\"https:\/\/en.wikipedia.org\/wiki\/Bcrypt\" rel=\"noopener noreferrer nofollow\"> <u>Bcrypt<\/u><\/a> (<strong>sync<\/strong>) \u2015 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u0435\u0439. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0448\u0438\u0444\u0440\u0435<a href=\"https:\/\/uk.wikipedia.org\/wiki\/Blowfish\" rel=\"noopener noreferrer nofollow\"> <u>Blowfish<\/u><\/a>.<\/p>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435, \u043a\u0430\u043a \u0438 \u0434\u043b\u044f Murmurhash. \u041e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0443\u043b\u0438 \u2015<a href=\"https:\/\/www.npmjs.com\/package\/bcryptjs\" rel=\"noopener noreferrer nofollow\"> <u>bcryptjs<\/u><\/a> and<a href=\"https:\/\/www.npmjs.com\/package\/bcrypt\" rel=\"noopener noreferrer nofollow\"> <u>bcrypt<\/u><\/a> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/865\/fae\/176\/865fae176c1d0ea5a0dca0855c985357.png\" width=\"774\" height=\"301\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/865\/fae\/176\/865fae176c1d0ea5a0dca0855c985357.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">const bcrypt = require('bcrypt'); ... const hashBcryptC = () => {   ...   const beforeAll = microseconds.now();   for (let i = 0; i &lt; 140; i++) {     const salt = bcrypt.genSaltSync(10);     const hash = bcrypt.hashSync(file[i], salt);   }   const afterAll = beforeAll + microseconds.since(beforeAll);   ... };<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/626\/ba9\/54d\/626ba954d6b87d435523192fbc04397f.gif\" width=\"1104\" height=\"570\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/626\/ba9\/54d\/626ba954d6b87d435523192fbc04397f.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0443\u043d\u0434\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a86\/861\/eaf\/a86861eafb0d1a2153b6465ccfc18b96.png\" width=\"744\" height=\"634\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a86\/861\/eaf\/a86861eafb0d1a2153b6465ccfc18b96.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 (sync) \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u2015 \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 Child Processes\/Cluster\/Worker Threads \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p><strong>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0442\u0432\u0430<\/strong><\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u043b\u043e \u2015 \u044d\u0442\u043e 140 \u0441\u0442\u0440\u043e\u043a (\u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u0435 \u0441\u043a\u0435\u043b\u0435\u0442\u043d\u044b\u0435 \u0434\u0440\u0430\u043a\u043e\u043d\u044b) \u0438 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0445 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u044c, \u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 Bcrypt. \u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0431\u0438\u0442\u0432\u0435 (\u0434\u0430\u0436\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0442\u0435 \u0436\u0435).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ae1\/315\/eea\/ae1315eea42711c1948eae1fa8c9039e.png\" width=\"787\" height=\"309\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ae1\/315\/eea\/ae1315eea42711c1948eae1fa8c9039e.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"javascript\">const bcrypt = require('bcrypt'); ... const hashPromise = (i) => async () => {   const salt = await bcrypt.genSalt(10);   const hash = await bcrypt.hash(file[i], salt); };  const hashBcryptC = async () => {   const tasks = [];   for (let i = 0; i &lt; 140; i++) {     tasks.push(hashPromise(i));   }    const beforeAll = microseconds.now();    await Promise.all(tasks.map((task) => task()));    const afterAll = beforeAll + microseconds.since(beforeAll);    return afterAll - beforeAll; };<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/811\/0dc\/5b1\/8110dc5b1fd06368813a64ce35d763b4.gif\" width=\"1178\" height=\"608\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/811\/0dc\/5b1\/8110dc5b1fd06368813a64ce35d763b4.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0442\u0432\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7d9\/770\/1ab\/7d97701abe05742344351eedbb3a2af0.png\" width=\"744\" height=\"637\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7d9\/770\/1ab\/7d97701abe05742344351eedbb3a2af0.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041c\u044b \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043b\u0438 Event Loop \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 UV thread pool, \u043f\u043e\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 C++ Addon \u0432\u043d\u043e\u0432\u044c \u043d\u0430 \u043a\u043e\u043d\u0435.<\/p>\n<p>\u2026\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0431\u0438\u0442\u0432:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4b0\/e6c\/405\/4b0e6c40526b0446045ea2f821db0286.png\" width=\"800\" height=\"415\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4b0\/e6c\/405\/4b0e6c40526b0446045ea2f821db0286.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043e\u0440\u0443\u0436\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u0440\u0445\u0430\u043d\u0433\u0435\u043b\u0430. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 \u0435\u0449\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435. \u042d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 UV thread pool (<a href=\"https:\/\/nodejs.org\/api\/cli.html#uv_threadpool_sizesize\" rel=\"noopener noreferrer nofollow\"><u>UV_TREADPOOL_SIZE=size<\/u><\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u043e (\u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 4 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 bycrypt \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442<a href=\"https:\/\/nodejs.org\/api\/cli.html#cli_uv_threadpool_size_size\" rel=\"noopener noreferrer nofollow\"> <strong><u>crypto.randomBytes()<\/u><\/strong><\/a>, \u043f\u043e\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <strong>bcrypt async <\/strong>\u043f\u043e\u0447\u0442\u0438 \u0432 2 \u0440\u0430\u0437\u0430 (\u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 8).<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c II<\/h2>\n<p><strong>\u041a\u0440\u0435\u043f\u043e\u0441\u0442\u044c Argon 2<\/strong><\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u044d\u043f\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043b\u0435 \u0437\u0430\u043c\u043a\u0430 \u201c<a href=\"https:\/\/en.wikipedia.org\/wiki\/Argon2\" rel=\"noopener noreferrer nofollow\"><u>Argon 2<\/u><\/a>\u201d. \u0415\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043b\u0438 \u0432 \u0447\u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c Password Hashing Competition \u0432 \u0438\u044e\u043b\u0435 2015. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 3 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>Argon2d \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A6%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D0%B0%D1%8F_%D0%B2%D0%B0%D0%BB%D1%8E%D1%82%D0%B0\" rel=\"noopener noreferrer nofollow\"> <u>\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u044b<\/u><\/a> \u0438<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%98%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0\" rel=\"noopener noreferrer nofollow\"> <u>\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c<\/u><\/a>, \u043d\u0435 \u043f\u043e\u0434\u0432\u0435\u0440\u0436\u0435\u043d\u043d\u044b\u0445<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D1%82%D0%B0%D0%BA%D0%B0_%D0%BF%D0%BE_%D1%81%D1%82%D0%BE%D1%80%D0%BE%D0%BD%D0%BD%D0%B8%D0%BC_%D0%BA%D0%B0%D0%BD%D0%B0%D0%BB%D0%B0%D0%BC\" rel=\"noopener noreferrer nofollow\"> <u>\u0430\u0442\u0430\u043a\u0430\u043c \u043f\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c \u043a\u0430\u043d\u0430\u043b\u0430\u043c<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p>Argon2i \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BC%D0%BF%D1%80%D0%BE%D0%BC%D0%B8%D1%81%D1%81_%D0%B2%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D0%B8_%D0%B8_%D0%BF%D0%B0%D0%BC%D1%8F%D1%82%D0%B8\" rel=\"noopener noreferrer nofollow\"> <u>trade-off \u0430\u0442\u0430\u043a<\/u><\/a>, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 d \u0438\u0437-\u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>Argon2id \u044d\u0442\u043e \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>Node.js \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u0443 \u043a\u0440\u0435\u043f\u043e\u0441\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f<a href=\"https:\/\/www.npmjs.com\/package\/argon2-browser\" rel=\"noopener noreferrer nofollow\"> <u>argon2-browser<\/u><\/a> (js) \u0438<a href=\"https:\/\/www.npmjs.com\/package\/hash-wasm\" rel=\"noopener noreferrer nofollow\"> <u>hash-wasm<\/u><\/a> (\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439) \u043c\u043e\u0434\u0443\u043b\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">const argon2 = require('argon2-browser'); ... const hashPromise = (i) => async () => {   const salt = new Uint8Array(16);   const hash = await argon2.hash({     pass: file[i],     salt,     time: 256,     mem: 512,     hashLen: 32,     parallelism: 1,     type: argon2.ArgonType.Argon2d,   }); };  const hashArgon2JS = async () => {   const tasks = [];   for (let i = 0; i &lt; 14; i++) {     tasks.push(hashPromise(i));   }    const beforeAll = microseconds.now();   await Promise.all(tasks.map((task) => task()));   const afterAll = beforeAll + microseconds.since(beforeAll);   ... };<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0ff\/bba\/aa8\/0ffbbaaa8cf0734b06e3a8b78630f3dd.gif\" width=\"795\" height=\"410\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0ff\/bba\/aa8\/0ffbbaaa8cf0734b06e3a8b78630f3dd.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0431\u0438\u0442\u0432\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a7a\/8ac\/1b1\/a7a8ac1b19b843ea4194a45124d88350.png\" width=\"630\" height=\"471\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a7a\/8ac\/1b1\/a7a8ac1b19b843ea4194a45124d88350.png\"\/><figcaption><\/figcaption><\/figure>\n<p>C++ Addon \u0441\u043d\u043e\u0432\u0430 \u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0442\u044b\u0445 CPU-bound \u0437\u0430\u0434\u0430\u043d\u0438\u0439.<\/p>\n<p><strong>\u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043c\u043a\u0430<\/strong><\/p>\n<p>\u041f\u043e\u043a\u0430 \u0432\u0441\u0435 \u0431\u0438\u0442\u0432\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u044b. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0433\u043e\u0440\u043e\u0434 \u0438 \u0437\u0430\u0440\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u0435\u043b\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043c\u0441\u044f \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043c\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043a\u043e\u043d\u0430\u043c\u0438 \u0438 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u044f\u043c\u0438. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0432\u0441\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <strong>xlsx<\/strong> \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0432 7 \u0444\u0430\u0439\u043b\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043f\u043e 5000 \u0441\u0442\u0440\u043e\u043a \u0432 \u043a\u0430\u0436\u0434\u043e\u043c (js<a href=\"https:\/\/www.npmjs.com\/package\/xlsx\" rel=\"noopener noreferrer nofollow\"> <u>xlsx<\/u><\/a> \u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439<a href=\"https:\/\/www.npmjs.com\/package\/xlsx-util\" rel=\"noopener noreferrer nofollow\"> <u>xlsx-util<\/u><\/a> \u043c\u043e\u0434\u0443\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0434\u043b\u044f \u201c\u043c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f\u201d).<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f (\u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0444\u0430\u0439\u043b\u0430):<\/p>\n<pre><code class=\"javascript\">const xlsx = require('xlsx'); ... const xlsxJS = async () => {   const array = [...Array(7).keys()];   const before = microseconds.now();   await Promise.all(array.map((i) => xlsx.readFile(`.\/helpers\/examples\/file_example_XLSX_5000 (${i}).xlsx`)));   const after = before + microseconds.since(before);   return after - before; };<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/00c\/3ef\/137\/00c3ef137fb454f6c48b33dfa5b93a63.gif\" width=\"1178\" height=\"608\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/00c\/3ef\/137\/00c3ef137fb454f6c48b33dfa5b93a63.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8ad\/ea6\/3af\/8adea63af0e5a8e9cd7b422671b64a05.png\" width=\"631\" height=\"469\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8ad\/ea6\/3af\/8adea63af0e5a8e9cd7b422671b64a05.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0441\u043c\u0435\u0448\u0430\u043d\u043d\u043e\u0435 I\/O (\u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430) \u0438 CPU (\u043f\u0430\u0440\u0441\u0438\u043d\u0433) \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435. C++ Addon \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437-\u0437\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0439 \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p><strong>\u0412\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d<\/strong><\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0437\u0430\u043a\u043e\u043d\u044b \u0438 \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0446\u0432\u0435\u0442\u0430\u044e\u0449\u0435\u0435 \u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c<a href=\"https:\/\/jsonnet.org\" rel=\"noopener noreferrer nofollow\"> <strong><u>jsonnet<\/u><\/strong><\/a> \u044f\u0437\u044b\u043a \u0442\u0435\u043c\u043f\u043b\u0435\u0439\u0442\u043e\u0432. \u041e\u043d \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0438 \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0434\u0443\u043b\u0438<a href=\"https:\/\/www.npmjs.com\/package\/@rbicker\/jsonnet\" rel=\"noopener noreferrer nofollow\"> <u>@rbicker\/jsonnet<\/u><\/a> (js) \u0438<a href=\"https:\/\/www.npmjs.com\/package\/@unboundedsystems\/jsonnet\" rel=\"noopener noreferrer nofollow\"> <u>@unboundedsystems\/jsonnet<\/u><\/a> (\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439).<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">const Jsonnet = require('@rbicker\/jsonnet'); ... const jsonnet = new Jsonnet();  const jsonnetJS = () => {   const beforeAll = microseconds.now();   for (let i = 0; i &lt; 7; i++) {     const myTemplate = `     {         person1: {             name: \"Alice\",             happy: true,         },         person2: self.person1 { name: \"Bob\" },     }`;     const output = jsonnet.eval(myTemplate);   }    const afterAll = beforeAll + microseconds.since(beforeAll);   ... };<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/394\/2f5\/be6\/3942f5be609147e5cab053c61532d0d9.gif\" width=\"883\" height=\"456\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/394\/2f5\/be6\/3942f5be609147e5cab053c61532d0d9.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.<\/p>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d6c\/5b6\/1b1\/d6c5b61b1cc31f63776e968253154675.png\" width=\"632\" height=\"470\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d6c\/5b6\/1b1\/d6c5b61b1cc31f63776e968253154675.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0427\u0430\u0441\u0442\u0438 II:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bb0\/b9d\/858\/bb0b9d8583f33455deea6a68399eb9e6.png\" width=\"1035\" height=\"464\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bb0\/b9d\/858\/bb0b9d8583f33455deea6a68399eb9e6.png\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u0418\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u0432\u044b\u0431\u043e\u0440\u0443 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0427\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u0434 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e. \u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044f \u2015 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0439 \u0432\u044b\u0431\u043e\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. Child Processes, Cluster, Worker Threads \u2015 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0432\u0430\u0448\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/addons.html\" rel=\"noopener noreferrer nofollow\"><u>C++ Addons<\/u><\/a>,<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/n-api.html\" rel=\"noopener noreferrer nofollow\"> <u>Node-API<\/u><\/a>,<a href=\"https:\/\/github.com\/neon-bindings\/neon\" rel=\"noopener noreferrer nofollow\"> <u>Neon library<\/u><\/a>).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e CPU \u0438\u043b\u0438 GPU \u044f\u0434\u0435\u0440).<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0439\u0442\u0435 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f (\u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 thread pool, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0439\u0442\u0435 CPU-bound \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0438 \u0442\u0434).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0439\u0434\u0438\u0442\u0435 \u043b\u0443\u0447\u0448\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0443\u044e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e (C\/C++\/Rust\/Go \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043d\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0438 event loop \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d) \u0438 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/672\/13c\/bc2\/67213cbc20bd43ff4f174cd6e3d4f352.png\" width=\"800\" height=\"450\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/672\/13c\/bc2\/67213cbc20bd43ff4f174cd6e3d4f352.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u044d\u043f\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0438 \u0432\u044b \u043f\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0431\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043b\u0435\u0433\u0435\u043d\u0434\u044b.<\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 \u043c\u043e\u0439 <a href=\"https:\/\/github.com\/novokhatskyioleksii\/WorkerThreadsvsAddons\" rel=\"noopener noreferrer nofollow\"><u>github<\/u><\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/589403\/\"> https:\/\/habr.com\/ru\/articles\/589403\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u042d\u043f\u0438\u0433\u0440\u0430\u0444<\/h2>\n<p>\u041d\u0438 \u043e\u0434\u0438\u043d \u0434\u0440\u0430\u043a\u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u0441\u0442\u043e\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u0433\u0430\u0434\u043a\u0430\u043c\u0438 \u0438 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043d\u044b\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0434\u043b\u044f \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u2015<em> <\/em><strong><em>\u0414\u0436.\u0420.\u0420. \u0422\u043e\u043b\u043a\u0438\u043d<\/em><\/strong><\/p>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430<\/h2>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u044c \u043f\u0443\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c JavaScript \u2015 CPU-bound \u0437\u0430\u0434\u0430\u043d\u0438\u0439. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u044b \u044d\u0442\u043e \u0432 2 \u0447\u0430\u0441\u0442\u044f\u0445. \u0412 \u0447\u0430\u0441\u0442\u0438 I \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e CPU-bound \u0437\u0430\u0434\u0430\u043d\u0438\u0439. \u0412 \u0447\u0430\u0441\u0442\u0438 II \u2015 \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f frontend, CPU+I\/O-bound \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435.<\/p>\n<h2>\u0427\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c?<\/h2>\n<p>Node.js \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f CPU intensive \u0437\u0430\u0434\u0430\u043d\u0438\u0439:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c CPU-bound \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044f event loop. \u041a\u0442\u043e-\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u043e \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0431\u044b\u043b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442. \u041f\u0440\u0430\u0432\u0434\u0430 \u043d\u0435 \u0443 \u0432\u0441\u0435\u0445 \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u044f\u0434\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/child_process.html\" rel=\"noopener noreferrer nofollow\"><u>Child Processes<\/u><\/a>), \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/cluster.html\" rel=\"noopener noreferrer nofollow\"> <u>cluster<\/u><\/a> \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u043d\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/worker_threads.html\" rel=\"noopener noreferrer nofollow\"> <u>Worker Threads<\/u><\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/addons.html\" rel=\"noopener noreferrer nofollow\"> <u>C++ Addon<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 CPU-bound \u0437\u0430\u0434\u0430\u043d\u0438\u044f. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u0434\u0443\u043c\u0430\u044e \u0432\u0441\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u0441\u0442\u0430\u0440\u0438\u043d\u043d\u044b\u0435 \u043b\u0435\u0433\u0435\u043d\u0434\u044b \u043f\u0440\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u201c\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f\u201d \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2015 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0441\u043f\u0435\u0445 (\u043d\u0430 \u044d\u0442\u043e\u0439 \u0444\u0440\u0430\u0437\u0435 \u0433\u0434\u0435-\u0442\u043e \u0432 \u043c\u0438\u0440\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u0430\u043f\u043b\u0430\u043a\u0430\u0442\u044c React Native \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0445 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0432\u0441\u0435 \u0443\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<h2>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b<\/h2>\n<p>\u041a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440 CPU-bound \u0437\u0430\u0434\u0430\u0447 \u043c\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0435 \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0441\u0442\u0430\u043d\u0443\u0442 \u201c\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f\u201d \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0432\u0435\u0440\u0441\u0438\u044f, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c JavaScript. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u0434 \u0431\u0443\u0434\u0435 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438: 8-\u044f\u0434\u0435\u0440\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 Intel\u00ae Core\u2122 i7\u20137700HQ @ 2,80 \u0413\u0413\u0446<\/p>\n<h2>\u0411\u0443\u0434\u0435\u0442 \u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432\u0435\u0441\u0435\u043b\u043e\u0435?<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u2015 \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0438\u0434\u0435\u044e, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f\u2026<\/p>\n<p>\u0418 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f, \u043a\u0440\u0443\u0442\u0430\u044f \u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0430\u044f \u0438\u0433\u0440\u0430\u2026\u00a0 1999-\u0433\u043e \u0433\u043e\u0434\u0430 \u2015 <strong>Heroes of Might and Magic III<\/strong><\/p>\n<h2>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043a\u0443\u043d\u0435\u043c\u0441\u044f \u0432 \u043b\u0435\u0433\u0435\u043d\u0434\u0443<\/h2>\n<p>\u041d\u0430\u0448 \u0433\u0435\u0440\u043e\u0439 \u2015 Node.js \u0438 \u043a\u0430\u043a \u0443 \u043b\u044e\u0431\u043e\u0433\u043e \u0433\u0435\u0440\u043e\u044f, \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u0443\u0442\u044c. \u041d\u0430\u0448 \u0433\u0435\u0440\u043e\u0439 \u043a\u0440\u0435\u043f\u043e\u043a \u0438 \u043c\u043e\u0433\u0443\u0447. \u0423\u0436\u0435 \u043f\u043e\u0431\u0435\u0434\u0438\u043b \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0440\u0430\u0433\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0441\u0430\u043c\u044b\u043c \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u043c \u0432\u0440\u0430\u0433\u043e\u043c \u2015 CPU-bound \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438.<\/p>\n<h2>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 Node.js<\/h2>\n<p>\u041d\u0430\u0448 \u0433\u0435\u0440\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0442\u0430\u043a \u043a\u043e\u0433\u043e \u043e\u043d \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u0441 \u0441\u043e\u0431\u043e\u0439?<\/p>\n<p>Cluster \u2015 \u044d\u0442\u043e 7 \u0447\u0435\u0440\u043d\u044b\u0445 \u0434\u0440\u0430\u043a\u043e\u043d\u043e\u0432, 7 Child Processes \u2015 7 \u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u0434\u0440\u0430\u043a\u043e\u043d\u043e\u0432 \u0442\u0430 1 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0434\u0440\u0430\u043a\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 JS, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0437\u0432\u0435\u0440\u0433\u0430\u0435\u0442 \u043d\u0430 \u0432\u0440\u0430\u0433\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u0443\u044e \u043e\u0433\u043d\u044f.<\/p>\n<p>7 Worker Threads \u2015 7 \u043c\u043e\u043b\u043e\u0434\u044b\u0445 \u0437\u0435\u043b\u0435\u043d\u044b\u0445 \u0434\u0440\u0430\u043a\u043e\u043d\u0430. \u041d\u0435\u043e\u043f\u044b\u0442\u043d\u044b\u0445, \u043d\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043a \u0431\u043e\u0440\u044c\u0431\u0435.<\/p>\n<p>1 C++ Addon \u2015 1 \u0430\u0440\u0445\u0430\u043d\u0433\u0435\u043b. \u041e\u043f\u044b\u0442\u043d\u044b\u0439 \u0432\u043e\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435\u0445 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 \u0441\u0432\u043e\u0435\u0439 \u0441\u0438\u043b\u044b, \u043d\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0432\u0448\u0438\u0439 \u0441\u0435\u0431\u044f \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0427\u0430\u0441\u0442\u044c \u0406<\/h2>\n<p><strong>\u041f\u0435\u0440\u0432\u0430\u044f \u0431\u0438\u0442\u0432\u0430<\/strong><\/p>\n<p>\u0418 \u043f\u0435\u0440\u0432\u043e\u0435 \u0437\u043b\u043e \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043f\u0443\u0442\u0438 \u044d\u0442\u043e 1,400,000 \u0441\u0442\u0440\u043e\u043a (\u0441\u043a\u0435\u043b\u0435\u0442\u043d\u0430\u044f \u043f\u0435\u0445\u043e\u0442\u0430), \u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0438\u0445 \u043f\u043e\u0431\u043e\u0440\u043e\u0442\u044c \u2015 \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0438\u0445 \u0447\u0435\u0440\u0435\u0437<a href=\"https:\/\/en.wikipedia.org\/wiki\/MurmurHash\" rel=\"noopener noreferrer nofollow\"> <u>Murmurhash<\/u><\/a> (\u043d\u0435 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f) \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c<a href=\"https:\/\/www.npmjs.com\/package\/murmurhash3js\" rel=\"noopener noreferrer nofollow\"> <u>murmurhash3js<\/u><\/a> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d, \u043a\u0430\u043a \u0447\u0438\u0441\u0442\u0430\u044f js \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438<a href=\"https:\/\/www.npmjs.com\/package\/murmurhash-native\" rel=\"noopener noreferrer nofollow\"> <u>murmurhash-native<\/u><\/a> \u043a\u0430\u043a \u201c\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f\u201d.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (JS 1 \u043f\u0440\u043e\u0446\u0435\u0441\u0441) \u2015 \u043d\u0438\u0447\u0435\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0445\u0435\u0448-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u0446\u0438\u043a\u043b\u0435 \u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435:<\/p>\n<pre><code class=\"javascript\">const murmurHash3 = require('murmurhash3js'); ... const hash128x64JS = () => {   ...   const beforeAll = microseconds.now();   for (let i = 0; i &lt; 1400000; i++) {     const hash = murmurHash3.x64.hash128(file[i]);   }   const afterAll = beforeAll + microseconds.since(beforeAll);   ... };<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (Child Processes) \u2015 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u043c (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/child_process.html#child_processspawncommand-args-options\" rel=\"noopener noreferrer nofollow\"><u>spawn<\/u><\/a>) \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0436\u0434\u0435\u043c \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u043e\u0432 (\u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u201cclose\u201d):<\/p>\n<pre><code class=\"javascript\">... let beforeJS; let afterJS; ... const hash128x64JSChildProcess = (i) => new Promise((resolve, reject) => {   const hash128x64JSChildProcess = spawn('node',     ['.\/runners\/murmurhash\/runChildProcess\/hash128x64JSChildProcess.js', i]);   ...   hash128x64JSChildProcess.stdout.on('close', () => {     ...     if (...) afterJS = beforeJS + microseconds.since(beforeJS);     resolve();   }); }); beforeJS = microseconds.now(); await Promise.all([   hash128x64JSChildProcess(0),   hash128x64JSChildProcess(1),   hash128x64JSChildProcess(2),   hash128x64JSChildProcess(3),   hash128x64JSChildProcess(4),   hash128x64JSChildProcess(5),   hash128x64JSChildProcess(6) ]); ...<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (Cluster) \u2015 \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u043b\u044f\u0435\u043c (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/cluster.html#clusterforkenv\" rel=\"noopener noreferrer nofollow\"><u>fork<\/u><\/a>) \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e (\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0447\u0438\u0441\u043b\u0430 \u044f\u0434\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430) \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0438 \u0436\u0434\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/cluster.html#event-message\" rel=\"noopener noreferrer nofollow\"><u>messages<\/u><\/a>) \u043e\u0442 \u043d\u0438\u0445 (\u043f\u0440\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b) \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f\u043a \u201c\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u201d \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430:<\/p>\n<pre><code class=\"javascript\">... const workers = [];  const masterProcess = () => new Promise((resolve, reject) => {   ...   let start = 0;   for (let i = 0; i &lt; 8; i++) {     const worker = cluster.fork();     workers.push(worker);      worker.on('message', (message) => {       ...       if (...) resolve(microseconds.since(start));     });   }    start = microseconds.now();   workers[0].send({ processNumber: 0 });   workers[1].send({ processNumber: 1 });   workers[2].send({ processNumber: 2 });   workers[3].send({ processNumber: 3 });   workers[4].send({ processNumber: 4 });   workers[5].send({ processNumber: 5 });   workers[6].send({ processNumber: 6 }); });  const childProcess = () => {   process.on('message', (message) => {     hash128x64JSCluster(message.processNumber);     process.send({ processNumber: message.processNumber });   }); }; ...<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (Worker Threads) \u2015 \u043f\u043e\u0447\u0442\u0438 \u0442\u0430 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0443 \u201ccluster\u201d \u2015 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/worker_threads.html#new-workerfilename-options\" rel=\"noopener noreferrer nofollow\"><u>workers<\/u><\/a>) \u0438 \u0436\u0434\u0435\u043c \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/worker_threads.html#workerismainthread\" rel=\"noopener noreferrer nofollow\"><u>main thread<\/u><\/a>) \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 (<a href=\"https:\/\/nodejs.org\/docs\/latest\/api\/worker_threads.html#event-message\" rel=\"noopener noreferrer nofollow\"><u>message<\/u><\/a>) \u043e\u0431 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<pre><code class=\"javascript\">... const threads = [];  const mainThread = () => new Promise((resolve, reject) => {   ...   const start = microseconds.now();   threads.push(new Worker(__filename, { workerData: { processNumber: 0 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 1 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 2 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 3 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 4 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 5 } }));   threads.push(new Worker(__filename, { workerData: { processNumber: 6 } }));    for (let worker of threads) {     ...     worker.on('message', (msg) => {       ...       if (...) resolve(microseconds.since(start));     });   } }); ...<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f (C++ Addon) \u2015 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c C++ Addon (\u043c\u043e\u0434\u0443\u043b\u044c) \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 (\u0442\u0430\u043a \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043a\u0430\u043a \u0432 JS \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438):<\/p>\n<pre><code class=\"javascript\">const { murmurHash128x64 } = require('murmurhash-native'); ... const hash128x64C = () => {   ...   const beforeAll = microseconds.now();   for (let i = 0; i &lt; 1400000; i++) {     const hash = murmurHash128x64(file[i]);   }   const afterAll = beforeAll + microseconds.since(beforeAll);   ... };<\/code><\/pre>\n<p>\u2026and \u201cAction!\u201d<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0435\u0440\u0432\u043e\u0439 \u0431\u0438\u0442\u0432\u044b:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c, C++ Addon \u2015 \u044d\u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. Child Processes\/Cluster\/Worker Threads \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p><strong>\u0412\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0443\u043d\u0434<\/strong><\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u043b\u043e \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043f\u0443\u0442\u0438 \u2015 \u044d\u0442\u043e 140 \u0441\u0442\u0440\u043e\u043a (\u0441\u043a\u0435\u043b\u0435\u0442\u043d\u044b\u0435 \u0434\u0440\u0430\u043a\u043e\u043d\u044b) \u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u044c \u0438\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e<a href=\"https:\/\/en.wikipedia.org\/wiki\/Bcrypt\" rel=\"noopener noreferrer nofollow\"> <u>Bcrypt<\/u><\/a> (<strong>sync<\/strong>) \u2015 \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u043e\u043b\u0435\u0439. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0448\u0438\u0444\u0440\u0435<a href=\"https:\/\/uk.wikipedia.org\/wiki\/Blowfish\" rel=\"noopener noreferrer nofollow\"> <u>Blowfish<\/u><\/a>.<\/p>\n<p>\u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435, \u043a\u0430\u043a \u0438 \u0434\u043b\u044f Murmurhash. \u041e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0443\u043b\u0438 \u2015<a href=\"https:\/\/www.npmjs.com\/package\/bcryptjs\" rel=\"noopener noreferrer nofollow\"> <u>bcryptjs<\/u><\/a> and<a href=\"https:\/\/www.npmjs.com\/package\/bcrypt\" rel=\"noopener noreferrer nofollow\"> <u>bcrypt<\/u><\/a> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">const bcrypt = require('bcrypt'); ... const hashBcryptC = () => {   ...   const beforeAll = microseconds.now();   for (let i = 0; i &lt; 140; i++) {     const salt = bcrypt.genSaltSync(10);     const hash = bcrypt.hashSync(file[i], salt);   }   const afterAll = beforeAll + microseconds.since(beforeAll);   ... };<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u0430\u0443\u043d\u0434\u0430:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 (sync) \u043b\u0443\u0447\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u2015 \u044d\u0442\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 Child Processes\/Cluster\/Worker Threads \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438\u0441\u044c \u043b\u0443\u0447\u0448\u0435.<\/p>\n<p><strong>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0431\u0438\u0442\u0432\u0430<\/strong><\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0437\u043b\u043e \u2015 \u044d\u0442\u043e 140 \u0441\u0442\u0440\u043e\u043a (\u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u044b\u0435 \u0441\u043a\u0435\u043b\u0435\u0442\u043d\u044b\u0435 \u0434\u0440\u0430\u043a\u043e\u043d\u044b) \u0438 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0445 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u044c, \u043d\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 Bcrypt. \u0418\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0431\u0438\u0442\u0432\u0435 (\u0434\u0430\u0436\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0442\u0435 \u0436\u0435).<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"javascript\">const bcrypt = require('bcrypt'); ... const hashPromise = (i) => async () => {   const salt = await bcrypt.genSalt(10);   const hash = await bcrypt.hash(file[i], salt); };  const hashBcryptC = async () => {   const tasks = [];   for (let i = 0; i &lt; 140; i++) {     tasks.push(hashPromise(i));   }    const beforeAll = microseconds.now();    await Promise.all(tasks.map((task) => task()));    const afterAll = beforeAll + microseconds.since(beforeAll);    return afterAll - beforeAll; };<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0438\u0442\u0432\u044b:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041c\u044b \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043b\u0438 Event Loop \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 UV thread pool, \u043f\u043e\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 C++ Addon \u0432\u043d\u043e\u0432\u044c \u043d\u0430 \u043a\u043e\u043d\u0435.<\/p>\n<p>\u2026\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0431\u0438\u0442\u0432:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043e\u0440\u0443\u0436\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u0440\u0445\u0430\u043d\u0433\u0435\u043b\u0430. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 \u0435\u0449\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435. \u042d\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 UV thread pool (<a href=\"https:\/\/nodejs.org\/api\/cli.html#uv_threadpool_sizesize\" rel=\"noopener noreferrer nofollow\"><u>UV_TREADPOOL_SIZE=size<\/u><\/a>), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u043e (\u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 4 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 bycrypt \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442<a href=\"https:\/\/nodejs.org\/api\/cli.html#cli_uv_threadpool_size_size\" rel=\"noopener noreferrer nofollow\"> <strong><u>crypto.randomBytes()<\/u><\/strong><\/a>, \u043f\u043e\u0442\u043e\u043c\u0443 \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <strong>bcrypt async <\/strong>\u043f\u043e\u0447\u0442\u0438 \u0432 2 \u0440\u0430\u0437\u0430 (\u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f 8).<\/p>\n<h2>\u0427\u0430\u0441\u0442\u044c II<\/h2>\n<p><strong>\u041a\u0440\u0435\u043f\u043e\u0441\u0442\u044c Argon 2<\/strong><\/p>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0439 \u044d\u043f\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043b\u0435 \u0437\u0430\u043c\u043a\u0430 \u201c<a href=\"https:\/\/en.wikipedia.org\/wiki\/Argon2\" rel=\"noopener noreferrer nofollow\"><u>Argon 2<\/u><\/a>\u201d. \u0415\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043b\u0438 \u0432 \u0447\u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043f\u043e\u0431\u0435\u0434\u0438\u0442\u0435\u043b\u0435\u043c Password Hashing Competition \u0432 \u0438\u044e\u043b\u0435 2015. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 3 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>Argon2d \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A6%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D0%B0%D1%8F_%D0%B2%D0%B0%D0%BB%D1%8E%D1%82%D0%B0\" rel=\"noopener noreferrer nofollow\"> <u>\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u044b<\/u><\/a> \u0438<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%98%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D0%B0%D1%8F_%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0\" rel=\"noopener noreferrer nofollow\"> <u>\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c<\/u><\/a>, \u043d\u0435 \u043f\u043e\u0434\u0432\u0435\u0440\u0436\u0435\u043d\u043d\u044b\u0445<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D1%82%D0%B0%D0%BA%D0%B0_%D0%BF%D0%BE_%D1%81%D1%82%D0%BE%D1%80%D0%BE%D0%BD%D0%BD%D0%B8%D0%BC_%D0%BA%D0%B0%D0%BD%D0%B0%D0%BB%D0%B0%D0%BC\" rel=\"noopener noreferrer nofollow\"> <u>\u0430\u0442\u0430\u043a\u0430\u043c \u043f\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c \u043a\u0430\u043d\u0430\u043b\u0430\u043c<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p>Argon2i \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BC%D0%BF%D1%80%D0%BE%D0%BC%D0%B8%D1%81%D1%81_%D0%B2%D1%80%D0%B5%D0%BC%D0%B5%D0%BD%D0%B8_%D0%B8_%D0%BF%D0%B0%D0%BC%D1%8F%D1%82%D0%B8\" rel=\"noopener noreferrer nofollow\"> <u>trade-off \u0430\u0442\u0430\u043a<\/u><\/a>, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 d \u0438\u0437-\u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0445\u043e\u0434\u043e\u0432 \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>Argon2id \u044d\u0442\u043e \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>Node.js \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u0443 \u043a\u0440\u0435\u043f\u043e\u0441\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f<a href=\"https:\/\/www.npmjs.com\/package\/argon2-browser\" rel=\"noopener noreferrer nofollow\"> <u>argon2-browser<\/u><\/a> (js) \u0438<a href=\"https:\/\/www.npmjs.com\/package\/hash-wasm\" rel=\"noopener noreferrer nofollow\"> <u>hash-wasm<\/u><\/a> (\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439) \u043c\u043e\u0434\u0443\u043b\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"javascript\">const argon2 = require('argon2-browser'); ... const hashPromise = (i) => async () => {   const salt = new Uint8Array(16);   const hash = await<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-395150","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/395150","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=395150"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/395150\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=395150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=395150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=395150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}