{"id":322462,"date":"2021-05-01T21:00:45","date_gmt":"2021-05-01T21:00:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=322462"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=322462","title":{"rendered":"\u0427\u0442\u043e \u0432\u043e\u0448\u043b\u043e \u0432 \u0440\u0435\u043b\u0438\u0437 \u0434\u0432\u0438\u0436\u043a\u0430 V8 \u0432\u0435\u0440\u0441\u0438\u0438 9.0"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/584\/1c2\/f5f\/5841c2f5fc0657e4633d7f5ee37a50c5.png\" width=\"683\" height=\"423\"><figcaption><\/figcaption><\/figure>\n<p>17 \u043c\u0430\u0440\u0442\u0430 2021 \u0431\u044b\u043b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0440\u0435\u043b\u0438\u0437 \u0434\u0435\u0432\u044f\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0432\u0438\u0436\u043a\u0430 V8. \u042d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 &#8212; \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0432\u043e\u0448\u043b\u043e \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0440\u0435\u043b\u0438\u0437\u0430.<\/p>\n<p>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442 <a href=\"https:\/\/v8.dev\/blog\/v8-release-90\" rel=\"noopener noreferrer nofollow\">V8 release v9.0<\/a><\/p>\n<h3>JavaScript<\/h3>\n<h4>\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f (match indices) \u0432 RegExp <\/h4>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 9.0, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 c \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0437\u0430\u0445\u0432\u0430\u0442\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u043c\u0443 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044e. \u042d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>.indices<\/code> \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u0444\u043b\u0430\u0433 <code>\/ d<\/code>.<\/p>\n<pre><code class=\"javascript\">const re = \/(a)(b)\/d;      \/\/ Note the \/d flag. const m = re.exec('ab'); console.log(m.indices[0]); \/\/ Index 0 is the whole match. \/\/ \u2192 [0, 2] console.log(m.indices[1]); \/\/ Index 1 is the 1st capture group. \/\/ \u2192 [0, 1] console.log(m.indices[2]); \/\/ Index 2 is the 2nd capture group. \/\/ \u2192 [1, 2]<\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e <a href=\"https:\/\/v8.dev\/features\/regexp-match-indices\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/p>\n<h4>\u0411\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e super<\/h4>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>super<\/code> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>super.x<\/code>) \u0431\u044b\u043b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0437\u0430 \u0441\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f V8 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u0432 TurboFan. \u0421 \u044d\u0442\u0438\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>super<\/code>, \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u043b\u0438\u0436\u0435 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u043d\u0430\u0440\u0430\u0432\u043d\u0435 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c, \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u043d\u0438\u0436\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3da\/ae1\/33a\/3daae133a759f40df7b243892558a8e3.png\" width=\"600\" height=\"371\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e <a href=\"https:\/\/v8.dev\/blog\/fast-super\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/p>\n<h4>\u0417\u0430\u043f\u0440\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 &#171;for ( async of &#171;<\/h4>\n<p>\u0411\u044b\u043b\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430 \u0432 V8 v9.0, <a href=\"https:\/\/chromium-review.googlesource.com\/c\/v8\/v8\/+\/2683221\" rel=\"noopener noreferrer nofollow\">\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/a>. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>for ( async of <\/code>\u043d\u0435 \u043f\u0430\u0440\u0441\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<h3>WebAssembly<\/h3>\n<h4>\u0411\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0432 JS-to-Wasm<\/h4>\n<p>V8 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 WebAssembly \u0438 JavaScript. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u043a\u043e\u0433\u0434\u0430 JavaScript \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e WebAssembly, \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443 JS-to-Wasm, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0443\u044e \u0437\u0430 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 JavaScript \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c WebAssembly, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u0430, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u044b \u0438\u0437 JavaScript \u0432 WebAssembly \u0431\u044b\u043b\u0438 \u043d\u0435 \u0442\u0430\u043a\u0438\u043c\u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u043c\u0438, \u043a\u0430\u043a \u0432\u044b\u0437\u043e\u0432\u044b \u0438\u0437 JavaScript \u0432 JavaScript. \u0427\u0442\u043e\u0431\u044b \u0441\u0432\u0435\u0441\u0442\u0438 \u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443 \u044d\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441\u0430, \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 JS-to-Wasm \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0432 \u0441\u0430\u0439\u0442 \u0432\u044b\u0437\u043e\u0432\u0430, \u0443\u043f\u0440\u043e\u0449\u0430\u044f \u043a\u043e\u0434 \u0438 \u0443\u0434\u0430\u043b\u044f\u044f \u044d\u0442\u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0439 \u0444\u0440\u0435\u0439\u043c.<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f WebAssembly, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0430 \u0434\u0432\u043e\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cpp\">double addNumbers(double x, double y) {   return x + y; }<\/code><\/pre>\n<p>\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0435\u043c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 JavaScript, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u0432\u0438\u0434\u0435 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432):<\/p>\n<pre><code class=\"javascript\">const addNumbers = instance.exports.addNumbers;  function vectorSum(len, v1, v2) {   const result = new Float64Array(len);   for (let i = 0; i &lt; len; i++) {     result[i] = addNumbers(v1[i], v2[i]);   }   return result; }  const N = 100_000_000; const v1 = new Float64Array(N); const v2 = new Float64Array(N); for (let i = 0; i &lt; N; i++) {   v1[i] = Math.random();   v2[i] = Math.random(); }  \/\/ Warm up. for (let i = 0; i &lt; 5; i++) {   vectorSum(N, v1, v2); }  \/\/ Measure. console.time(); const result = vectorSum(N, v1, v2); console.timeEnd();<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/402\/eec\/f59\/402eecf59d0dc044934d16ef4acdb1a3.png\" width=\"548\" height=\"368\"><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439, \u0438 \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043b\u0430\u0433\u0430 <code>--turbo-inline-js-wasm-calls<\/code>.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c. <a href=\"https:\/\/docs.google.com\/document\/d\/1mXxYnYN77tK-R1JOVo6tFG3jNpMzfueQN1Zp5h3r9aM\/edit\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0437\u0430\u0439\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/a>.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/555420\/\"> https:\/\/habr.com\/ru\/post\/555420\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>17 \u043c\u0430\u0440\u0442\u0430 2021 \u0431\u044b\u043b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u0440\u0435\u043b\u0438\u0437 \u0434\u0435\u0432\u044f\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0432\u0438\u0436\u043a\u0430 V8. \u042d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442 &#8212; \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0432\u043e\u0448\u043b\u043e \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0440\u0435\u043b\u0438\u0437\u0430.<\/p>\n<p>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0441\u0442 <a href=\"https:\/\/v8.dev\/blog\/v8-release-90\" rel=\"noopener noreferrer nofollow\">V8 release v9.0<\/a><\/p>\n<h3>JavaScript<\/h3>\n<h4>\u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f (match indices) \u0432 RegExp <\/h4>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 9.0, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445 \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 c \u0433\u0440\u0443\u043f\u043f\u0430\u043c\u0438 \u0437\u0430\u0445\u0432\u0430\u0442\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u043c\u0443 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044e. \u042d\u0442\u043e\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>.indices<\/code> \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u0444\u043b\u0430\u0433 <code>\/ d<\/code>.<\/p>\n<pre><code class=\"javascript\">const re = \/(a)(b)\/d;      \/\/ Note the \/d flag. const m = re.exec('ab'); console.log(m.indices[0]); \/\/ Index 0 is the whole match. \/\/ \u2192 [0, 2] console.log(m.indices[1]); \/\/ Index 1 is the 1st capture group. \/\/ \u2192 [0, 1] console.log(m.indices[2]); \/\/ Index 2 is the 2nd capture group. \/\/ \u2192 [1, 2]<\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e <a href=\"https:\/\/v8.dev\/features\/regexp-match-indices\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/p>\n<h4>\u0411\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e super<\/h4>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>super<\/code> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>super.x<\/code>) \u0431\u044b\u043b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0437\u0430 \u0441\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f V8 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u0432 TurboFan. \u0421 \u044d\u0442\u0438\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438, \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>super<\/code>, \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u043b\u0438\u0436\u0435 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u043d\u0430\u0440\u0430\u0432\u043d\u0435 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c, \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u043d\u0438\u0436\u0435.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e <a href=\"https:\/\/v8.dev\/blog\/fast-super\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a><\/p>\n<h4>\u0417\u0430\u043f\u0440\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 &#171;for ( async of &#171;<\/h4>\n<p>\u0411\u044b\u043b\u0430 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u0430 \u0432 V8 v9.0, <a href=\"https:\/\/chromium-review.googlesource.com\/c\/v8\/v8\/+\/2683221\" rel=\"noopener noreferrer nofollow\">\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/a>. \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>for ( async of <\/code>\u043d\u0435 \u043f\u0430\u0440\u0441\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<h3>WebAssembly<\/h3>\n<h4>\u0411\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0432 JS-to-Wasm<\/h4>\n<p>V8 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 WebAssembly \u0438 JavaScript. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435, \u043a\u043e\u0433\u0434\u0430 JavaScript \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e WebAssembly, \u0432\u044b\u0437\u043e\u0432 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0447\u0435\u0440\u0435\u0437 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0443 JS-to-Wasm, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0443\u044e \u0437\u0430 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 JavaScript \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u044c WebAssembly, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0430\u0434\u0430\u043f\u0442\u0430\u0446\u0438\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u0430, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438.<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0430 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u044b \u0438\u0437 JavaScript \u0432 WebAssembly \u0431\u044b\u043b\u0438 \u043d\u0435 \u0442\u0430\u043a\u0438\u043c\u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u043c\u0438, \u043a\u0430\u043a \u0432\u044b\u0437\u043e\u0432\u044b \u0438\u0437 JavaScript \u0432 JavaScript. \u0427\u0442\u043e\u0431\u044b \u0441\u0432\u0435\u0441\u0442\u0438 \u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0443 \u044d\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441\u0430, \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430 JS-to-Wasm \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0432 \u0441\u0430\u0439\u0442 \u0432\u044b\u0437\u043e\u0432\u0430, \u0443\u043f\u0440\u043e\u0449\u0430\u044f \u043a\u043e\u0434 \u0438 \u0443\u0434\u0430\u043b\u044f\u044f \u044d\u0442\u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0439 \u0444\u0440\u0435\u0439\u043c.<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f WebAssembly, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0430 \u0434\u0432\u043e\u0439\u043d\u044b\u0445 \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cpp\">double addNumbers(double x, double y) {   return x + y; }<\/code><\/pre>\n<p>\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0435\u043c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 JavaScript, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u0432\u0438\u0434\u0435 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432):<\/p>\n<pre><code class=\"javascript\">const addNumbers = instance.exports.addNumbers;  function vectorSum(len, v1, v2) {   const result = new Float64Array(len);   for (let i = 0; i &lt; len; i++) {     result[i] = addNumbers(v1[i], v2[i]);   }   return result; }  const N = 100_000_000; const v1 = new Float64Array(N); const v2 = new Float64Array(N); for (let i = 0; i &lt; N; i++) {   v1[i] = Math.random();   v2[i] = Math.random(); }  \/\/ Warm up. for (let i = 0; i &lt; 5; i++) {   vectorSum(N, v1, v2); }  \/\/ Measure. console.time(); const result = vectorSum(N, v1, v2); console.timeEnd();<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0439, \u0438 \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043b\u0430\u0433\u0430 <code>--turbo-inline-js-wasm-calls<\/code>.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c. <a href=\"https:\/\/docs.google.com\/document\/d\/1mXxYnYN77tK-R1JOVo6tFG3jNpMzfueQN1Zp5h3r9aM\/edit\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0437\u0430\u0439\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/a>.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/555420\/\"> https:\/\/habr.com\/ru\/post\/555420\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-322462","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322462","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=322462"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/322462\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=322462"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=322462"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=322462"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}