{"id":308813,"date":"2020-08-21T09:00:31","date_gmt":"2020-08-21T09:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=308813"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=308813","title":{"rendered":"\u041d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u2014 \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u044b\u0439. \u041e\u0431\u0433\u043e\u043d\u044f\u0435\u043c map, filter \u0438 reduce \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u0445"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/516034\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wv\/rq\/ig\/wvrqiglyv5qbc8wmmri0dnujz5s.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u043d\u0430\u0437\u0430\u0434 \u044f \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b \u043f\u043e\u0441\u0442 <a href=\"https:\/\/habr.com\/ru\/post\/514716\/\">LINQ \u043d\u0430 JavaScript \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/a>. \u041d\u043e \u043c\u043e\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0443\u043f\u0430\u043b\u0430 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0438 <a href=\"https:\/\/lodash.com\/\" rel=\"nofollow\">Lodash<\/a>. \u0412 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e, \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0421\u043a\u0430\u0436\u0443 \u0441\u0440\u0430\u0437\u0443: \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043e\u0442\u043a\u0440\u043e\u0432\u0435\u043d\u0438\u0439, \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0435\u0437\u0443\u043c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0442. \u0434. \u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u044f\u0437\u044b\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0441\u0432\u043e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f, \u0443 \u043c\u0435\u043d\u044f \u0441\u0442\u043e\u044f\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043b\u0438\u0448\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u0435\u0448\u0435\u0432\u0438\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430. \u042f \u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c callback, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0434\u0430\u0436\u0435 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e \u043c\u044b\u0441\u043b\u0438, \u0447\u0442\u043e map, filter \u0438\u043b\u0438 reduce \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u0430\u0436\u0435 \u0447\u0443\u0442\u043e\u0447\u043a\u0443 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0432\u0435\u0442\u0430.<\/p>\n<p>  <\/p>\n<h1 id=\"prezhde-chem-my-pristupim\">\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c<\/h1>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/nr\/49\/xo\/nr49xoijls7ljcztepqlfolfp0q.jpeg\"><\/p>\n<p>  <\/p>\n<h3 id=\"pogovorim-o-statistike\">\u041f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u0440\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/li>\n<li>\u0410\u043d\u0430\u043b\u043e\u0433 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e for of<\/li>\n<li>\u0410\u043d\u0430\u043b\u043e\u0433 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e for<\/li>\n<li>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/lodash.com\/\" rel=\"nofollow\">Lodash<\/a><\/li>\n<li>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0438\u0437 \u043c\u043e\u0435\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/afferenslucem\/ursus-utilus-collections\" rel=\"nofollow\">ursus-utilus-collections<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<blockquote><p>\u0410\u0445\u0442\u0443\u043d\u0433!<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u0438\u0437 \u043c\u043e\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u0441\u0443\u0433\u0443\u0431\u043e \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 for.<br \/>  \u041d\u043e \u044f \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u0437\u0434\u0435\u0441\u044c \u043a\u043e\u0434 \u0441 \u043d\u0438\u043c\u0438 \u0441\u0443\u0433\u0443\u0431\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b <del>\u043f\u043e\u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f<\/del> \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438.<\/p><\/blockquote>\n<p>\u0417\u0430 \u0437\u0430\u043c\u0435\u0440 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c <a href=\"https:\/\/benchmarkjs.com\" rel=\"nofollow\">Benchmark.js<\/a>. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b \u0437\u0430\u043c\u0435\u0440\u044b 10 \u0440\u0430\u0437 \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0432 10,000,000 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<br \/>  \u0421\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: Node.js.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0441 \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<p>\u042f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0438 \u0435\u0433\u043e <strong>\u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u0440\u0435\u0434\u043d\u0438\u0439<\/strong> \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u043e\u0439: \u0441 \u043c\u0435\u0436\u043a\u0432\u0430\u0440\u0442\u0438\u043b\u044c\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u0438 \u0441 \u043c\u0435\u0434\u0438\u0430\u043d\u043d\u044b\u043c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c\u0438. \u0418 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0432\u0435\u0441\u044c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a-\u043b\u043e\u0433.<\/p>\n<p>  <\/p>\n<h1 id=\"pristupim\">\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c<\/h1>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/c4\/pv\/xh\/c4pvxhmmev2fgeud4pa28txggmw.jpeg\"><\/p>\n<p>  <\/p>\n<h2 id=\"filter\">Filter<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043c\u0435\u0440\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u0447\u0435\u0442\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const filterCondition = (item: number) =&gt; !!(item % 2);<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nativnaya-filtraciya\">\u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">array.filter(filterCondition);<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  native filter x 3.58 ops\/sec \u00b15.48% (13 runs sampled)<\/p><\/blockquote>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"for-of\">For of<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const result = [];  for(let item of array) {     if(filterCondition(item)) {         result.push(item)     } }<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  for\u2026 of x 3.48 ops\/sec \u00b13.46% (14 runs sampled)<\/p><\/blockquote>\n<p>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435, for of \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043f\u0440\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438, \u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u2014 \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"for\">For<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">filterSuite.add('for', () =&gt; {     const result = [];      for(let i = 0; i &lt; array.length; i++) {         const item = array[i]         if(filterCondition(item)) {             result.push(item)         }     } })<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  for x 6.92 ops\/sec \u00b15.47% (20 runs sampled)<\/p><\/blockquote>\n<p>\u041e\u0431\u044b\u0447\u043d\u044b\u0439 for \u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442 filter \u0432 <strong>2 \u0440\u0430\u0437\u0430<\/strong>.<\/p>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"lodash\">Lodash<\/h3>\n<p>  <\/p>\n<p><strong>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0438\u0433\u0440\u043e\u043a\u0430\u043c \u043d\u0430 \u043f\u043e\u043b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439:<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">lodash(array).filter(filterCondition).value();<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  lodash filter x 3.60 ops\/sec \u00b14.13% (13 runs sampled)<\/p><\/blockquote>\n<p>Lodash \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0443\u0441\u0442\u0443\u043f\u0430\u0435\u0442 filter.<\/p>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"moya-biblioteka\">\u041c\u043e\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ursus(array).where(filterCondition).toArray();<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  ursus where x 6.87 ops\/sec \u00b14.86% (20 runs sampled)<\/p><\/blockquote>\n<p>\u041c\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u00b1 \u0440\u0430\u0432\u043d\u0430 for, \u043d\u043e \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"itogi\">\u0418\u0442\u043e\u0433\u0438<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Benchmark log<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">lodash filter x 3.75 ops\/sec \u00b14.09% (13 runs sampled) native filter x 3.35 ops\/sec \u00b17.99% (13 runs sampled) for ... of x 3.38 ops\/sec \u00b13.88% (13 runs sampled) for x 6.04 ops\/sec \u00b13.54% (20 runs sampled) optimized for x 5.82 ops\/sec \u00b13.05% (20 runs sampled) ursus where x 5.83 ops\/sec \u00b14.62% (21 runs sampled)  lodash filter x 3.37 ops\/sec \u00b13.40% (13 runs sampled) native filter x 3.33 ops\/sec \u00b14.76% (13 runs sampled) for ... of x 3.86 ops\/sec \u00b19.36% (14 runs sampled) for x 6.92 ops\/sec \u00b15.47% (20 runs sampled) optimized for x 6.96 ops\/sec \u00b14.22% (20 runs sampled) ursus where x 6.71 ops\/sec \u00b14.75% (19 runs sampled)  lodash filter x 3.51 ops\/sec \u00b14.94% (13 runs sampled) native filter x 3.72 ops\/sec \u00b10.74% (13 runs sampled) for ... of x 3.54 ops\/sec \u00b12.14% (14 runs sampled) for x 6.84 ops\/sec \u00b14.60% (20 runs sampled) optimized for x 6.85 ops\/sec \u00b13.58% (19 runs sampled) ursus where x 6.46 ops\/sec \u00b111.83% (20 runs sampled)  lodash filter x 3.55 ops\/sec \u00b16.26% (13 runs sampled) native filter x 3.66 ops\/sec \u00b13.06% (13 runs sampled) for ... of x 3.41 ops\/sec \u00b14.28% (14 runs sampled) for x 6.95 ops\/sec \u00b13.85% (20 runs sampled) optimized for x 6.79 ops\/sec \u00b14.33% (20 runs sampled) ursus where x 7.17 ops\/sec \u00b13.29% (21 runs sampled)  lodash filter x 3.63 ops\/sec \u00b13.38% (13 runs sampled) native filter x 3.63 ops\/sec \u00b13.35% (13 runs sampled) for ... of x 3.44 ops\/sec \u00b13.99% (14 runs sampled) for x 6.89 ops\/sec \u00b14.53% (20 runs sampled) optimized for x 6.95 ops\/sec \u00b13.17% (20 runs sampled) ursus where x 6.87 ops\/sec \u00b14.86% (20 runs sampled)  lodash filter x 3.60 ops\/sec \u00b14.13% (13 runs sampled) native filter x 3.58 ops\/sec \u00b15.48% (13 runs sampled) for ... of x 3.48 ops\/sec \u00b13.46% (14 runs sampled) for x 6.95 ops\/sec \u00b13.73% (20 runs sampled) optimized for x 6.78 ops\/sec \u00b15.62% (20 runs sampled) ursus where x 7.17 ops\/sec \u00b13.79% (21 runs sampled)  lodash filter x 3.64 ops\/sec \u00b14.11% (13 runs sampled) native filter x 3.63 ops\/sec \u00b13.35% (13 runs sampled) for ... of x 3.55 ops\/sec \u00b12.36% (14 runs sampled) for x 6.91 ops\/sec \u00b14.51% (20 runs sampled) optimized for x 6.89 ops\/sec \u00b13.76% (20 runs sampled) ursus where x 7.03 ops\/sec \u00b14.84% (21 runs sampled)  lodash filter x 3.59 ops\/sec \u00b14.17% (13 runs sampled) native filter x 3.60 ops\/sec \u00b13.14% (13 runs sampled) for ... of x 3.45 ops\/sec \u00b14.69% (14 runs sampled) for x 7.09 ops\/sec \u00b12.65% (20 runs sampled) optimized for x 6.81 ops\/sec \u00b12.90% (20 runs sampled) ursus where x 7.15 ops\/sec \u00b12.60% (21 runs sampled)  lodash filter x 3.60 ops\/sec \u00b15.57% (13 runs sampled) native filter x 3.60 ops\/sec \u00b14.55% (13 runs sampled) for ... of x 3.39 ops\/sec \u00b17.33% (13 runs sampled) for x 5.71 ops\/sec \u00b12.74% (19 runs sampled) optimized for x 5.85 ops\/sec \u00b12.70% (20 runs sampled) ursus where x 6.10 ops\/sec \u00b12.43% (21 runs sampled)  lodash filter x 3.18 ops\/sec \u00b15.88% (13 runs sampled) native filter x 3.34 ops\/sec \u00b14.43% (13 runs sampled) for ... of x 3.89 ops\/sec \u00b16.84% (14 runs sampled) for x 7.09 ops\/sec \u00b12.79% (21 runs sampled) optimized for x 6.70 ops\/sec \u00b13.32% (20 runs sampled) ursus where x 7.07 ops\/sec \u00b14.02% (20 runs sampled)<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th>\u041c\u0435\u0436\u043a\u0432. \u0421\u0440\u0435\u0434\u043d\u0435\u0435<\/th>\n<th>\u041c\u0435\u0434\u0438\u0430\u043d\u0430<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>filter<\/td>\n<td>3,57 ops\/sec<\/td>\n<td>3,60 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>for<\/td>\n<td>3,48 ops\/sec<\/td>\n<td>3,47 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>for of<\/td>\n<td>6,91 ops\/sec<\/td>\n<td>6,92 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>lodash<\/td>\n<td>3,58 ops\/sec<\/td>\n<td>3,60 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>ursus<\/td>\n<td>6,88 ops\/sec<\/td>\n<td>6,95 ops\/sec<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<h4 id=\"rezultaty-gonki\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0433\u043e\u043d\u043a\u0438:<\/h4>\n<p>  <\/p>\n<p>1) For<br \/>  2) Ursus<br \/>  3) Lodash<br \/>  4) Filter<br \/>  5) For of<\/p>\n<p>  <\/p>\n<h2 id=\"map\">Map<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e \u0432\u0441\u0435\u043c \u0447\u0438\u0441\u043b\u0430\u043c <strong>+1<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const mapCondition = (item: number) =&gt; item + 1;<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nativnoe-otobrazhenie\">\u041d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">array.map(mapCondition);<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  native map x 0.68 ops\/sec \u00b13.60% (6 runs sampled)<\/p><\/blockquote>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"for-of-1\">For of<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const result = []; for(let item of array) {     result.push(mapCondition(item)) }<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  for\u2026 of x 2.19 ops\/sec \u00b13.47% (10 runs sampled)<\/p><\/blockquote>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f for of \u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 <strong>3 \u0440\u0430\u0437\u0430<\/strong>.<\/p>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"for-1\">For<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const result = []; for(let i = 0; i &lt; array.length; i++) {     result.push(mapCondition(array[i])) }<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  for x 3.49 ops\/sec \u00b16.82% (12 runs sampled)<\/p><\/blockquote>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 for \u043e\u0431\u0433\u043e\u043d\u044f\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 <strong>5 \u0440\u0430\u0437<\/strong>.<\/p>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"lodash-1\">Lodash<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">lodash(array).map(mapCondition).value();<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  lodash map x 5.78 ops\/sec \u00b19.03% (18 runs sampled)<\/p><\/blockquote>\n<p>Lodash \u043e\u0431\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u0435\u0445 \u0432 <strong>9 \u0440\u0430\u0437<\/strong>!<\/p>\n<p>  <\/p>\n<blockquote><p>\u0427\u0435\u0441\u0442\u043d\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0438\u043a\u0438, \u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u043a\u0430\u043a \u043e\u043d\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0434\u043e\u0431\u0438\u043b\u0438\u0441\u044c.<\/p><\/blockquote>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"moya-biblioteka-1\">\u041c\u043e\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ursus(array).select(mapCondition).toArray();<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  ursus select x 3.54 ops\/sec \u00b15.71% (13 runs sampled)<\/p><\/blockquote>\n<p>\u041a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0443\u0442\u043e\u0447\u043a\u0443 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e for, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430. \u00af_(\u30c4)_\/\u00af<\/p>\n<p>  <\/p>\n<h3 id=\"itogi-1\">\u0418\u0442\u043e\u0433\u0438<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Benchmark log<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">lodash map x 6.08 ops\/sec \u00b14.84% (19 runs sampled) native map x 0.57 ops\/sec \u00b117.60% (6 runs sampled) for ... of x 1.91 ops\/sec \u00b113.65% (9 runs sampled) for x 3.51 ops\/sec \u00b15.25% (13 runs sampled) optimized for x 3.62 ops\/sec \u00b17.49% (13 runs sampled) ursus select x 3.29 ops\/sec \u00b19.24% (13 runs sampled)  lodash map x 5.59 ops\/sec \u00b110.61% (19 runs sampled) native map x 0.61 ops\/sec \u00b111.70% (6 runs sampled) for ... of x 2.30 ops\/sec \u00b12.13% (10 runs sampled) for x 3.72 ops\/sec \u00b14.39% (13 runs sampled) optimized for x 3.58 ops\/sec \u00b15.24% (13 runs sampled) ursus select x 3.58 ops\/sec \u00b15.21% (13 runs sampled)  lodash map x 6.06 ops\/sec \u00b15.23% (19 runs sampled) native map x 0.68 ops\/sec \u00b13.60% (6 runs sampled) for ... of x 2.27 ops\/sec \u00b13.49% (10 runs sampled) for x 3.45 ops\/sec \u00b110.41% (13 runs sampled) optimized for x 3.59 ops\/sec \u00b14.29% (13 runs sampled) ursus select x 3.54 ops\/sec \u00b16.08% (12 runs sampled)  lodash map x 5.81 ops\/sec \u00b17.23% (19 runs sampled) native map x 0.68 ops\/sec \u00b13.63% (6 runs sampled) for ... of x 2.31 ops\/sec \u00b17.11% (10 runs sampled) for x 3.62 ops\/sec \u00b14.74% (13 runs sampled) optimized for x 3.45 ops\/sec \u00b16.67% (13 runs sampled) ursus select x 3.64 ops\/sec \u00b14.42% (13 runs sampled)  lodash map x 6.03 ops\/sec \u00b15.26% (20 runs sampled) native map x 0.69 ops\/sec \u00b16.27% (6 runs sampled) for ... of x 2.12 ops\/sec \u00b18.87% (10 runs sampled) for x 3.29 ops\/sec \u00b19.33% (13 runs sampled) optimized for x 3.53 ops\/sec \u00b15.18% (13 runs sampled) ursus select x 3.66 ops\/sec \u00b14.03% (13 runs sampled)  lodash map x 5.78 ops\/sec \u00b19.03% (18 runs sampled) native map x 0.65 ops\/sec \u00b16.52% (6 runs sampled) for ... of x 2.07 ops\/sec \u00b17.41% (10 runs sampled) for x 3.49 ops\/sec \u00b16.82% (12 runs sampled) optimized for x 3.50 ops\/sec \u00b15.93% (13 runs sampled) ursus select x 3.54 ops\/sec \u00b15.71% (13 runs sampled)  lodash map x 5.68 ops\/sec \u00b18.47% (18 runs sampled) native map x 0.67 ops\/sec \u00b16.40% (6 runs sampled) for ... of x 2.11 ops\/sec \u00b15.06% (10 runs sampled) for x 3.52 ops\/sec \u00b15.58% (13 runs sampled) optimized for x 3.29 ops\/sec \u00b15.51% (13 runs sampled) ursus select x 3.38 ops\/sec \u00b15.31% (13 runs sampled)  lodash map x 6.37 ops\/sec \u00b13.10% (19 runs sampled) native map x 0.67 ops\/sec \u00b12.43% (6 runs sampled) for ... of x 2.19 ops\/sec \u00b13.47% (10 runs sampled) for x 3.41 ops\/sec \u00b18.13% (13 runs sampled) optimized for x 3.54 ops\/sec \u00b15.15% (13 runs sampled) ursus select x 3.53 ops\/sec \u00b16.28% (13 runs sampled)  lodash map x 5.85 ops\/sec \u00b111.04% (19 runs sampled) native map x 0.66 ops\/sec \u00b14.30% (6 runs sampled) for ... of x 2.20 ops\/sec \u00b12.97% (10 runs sampled) for x 3.45 ops\/sec \u00b18.03% (13 runs sampled) optimized for x 3.48 ops\/sec \u00b15.13% (13 runs sampled) ursus select x 3.68 ops\/sec \u00b13.33% (13 runs sampled)  lodash map x 5.31 ops\/sec \u00b112.87% (18 runs sampled) native map x 0.68 ops\/sec \u00b14.26% (6 runs sampled) for ... of x 2.11 ops\/sec \u00b16.97% (10 runs sampled) for x 3.35 ops\/sec \u00b16.12% (13 runs sampled) optimized for x 3.38 ops\/sec \u00b15.55% (13 runs sampled) ursus select x 3.54 ops\/sec \u00b16.20% (13 runs sampled)<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th>\u041c\u0435\u0436\u043a\u0432. \u0421\u0440\u0435\u0434\u043d\u0435\u0435<\/th>\n<th>\u041c\u0435\u0434\u0438\u0430\u043d\u0430<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>map<\/td>\n<td>0.67 ops\/sec<\/td>\n<td>0.67 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>for<\/td>\n<td>2.17 ops\/sec<\/td>\n<td>2.16 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>for of<\/td>\n<td>3.47 ops\/sec<\/td>\n<td>3.47 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>lodash<\/td>\n<td>5.79 ops\/sec<\/td>\n<td>5.80 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>ursus<\/td>\n<td>3.56 ops\/sec<\/td>\n<td>3.54 ops\/sec<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<h4 id=\"rezultaty-gonki-1\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0433\u043e\u043d\u043a\u0438:<\/h4>\n<p>  <\/p>\n<p>1) Lodash<br \/>  2) Ursus<br \/>  3) For<br \/>  4) For of<br \/>  5) Map<\/p>\n<p>  <\/p>\n<h2 id=\"reduce\">Reduce<\/h2>\n<p>  <\/p>\n<p>\u0421\u0432\u0435\u0440\u0442\u043a\u0443 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const sumCondition = (item1: number, item2: number) =&gt; item1 + item2;<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nativnaya-svertka\">\u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0432\u0435\u0440\u0442\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">array.reduce(sumCondition);<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  native reduce x 6.09 ops\/sec \u00b19.13% (20 runs sampled)<\/p><\/blockquote>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"for-of-2\">For of<\/h3>\n<p>  <\/p>\n<blockquote><p>\u041f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0433\u043e\u043d\u043a\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b \u043a\u0430\u043a \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043b\u0430\u0434\u0438\u0442\u044c \u0431\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c. \u0410 \u0441 \u043d\u0438\u043c\u0438 \u0437\u0430\u043c\u0435\u0440\u044b \u0443\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u0442\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435.<\/p><\/blockquote>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"for-2\">For<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">let result = array[0]; for(let i = 1; i &lt; array.length; i++) {     result = sumCondition(result, array[i]) }<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  for x 57.01 ops\/sec \u00b12.53% (59 runs sampled)<\/p><\/blockquote>\n<p>For \u043e\u0431\u0445\u043e\u0434\u0438\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0447\u0442\u0438 \u0432 <strong>10 \u0440\u0430\u0437<\/strong>!<\/p>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"lodash-2\">Lodash<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">lodash(array).sum();<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  lodash sum x 8.30 ops\/sec \u00b17.79% (25 runs sampled)<\/p><\/blockquote>\n<p>\u0410 \u0432\u043e\u0442 lodash \u043f\u043e\u0434\u043a\u0430\u0447\u0430\u043b, \u043e\u043d \u043f\u043e\u0447\u0442\u0438 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 reduce.<\/p>\n<p>  <\/p>\n<hr>\n<p>  <\/p>\n<h3 id=\"moya-biblioteka-2\">\u041c\u043e\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ursus(array).sum(sumCondition);<\/code><\/pre>\n<p>  <\/p>\n<blockquote><p>Benchmark<br \/>  ursus sum x 56.12 ops\/sec \u00b12.38% (58 runs sampled)<\/p><\/blockquote>\n<p>  <\/p>\n<h3 id=\"itogi-2\">\u0418\u0442\u043e\u0433\u0438<\/h3>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Benchmark log<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">lodash sum x 8.60 ops\/sec \u00b14.35% (25 runs sampled) native reduce x 6.69 ops\/sec \u00b13.73% (21 runs sampled) for x 68.67 ops\/sec \u00b13.41% (70 runs sampled) optimized for x 70.75 ops\/sec \u00b12.63% (72 runs sampled) ursus sum x 67.78 ops\/sec \u00b13.12% (70 runs sampled)  lodash sum x 9.00 ops\/sec \u00b13.93% (26 runs sampled) native reduce x 5.47 ops\/sec \u00b121.31% (19 runs sampled) for x 56.61 ops\/sec \u00b12.70% (59 runs sampled) optimized for x 56.85 ops\/sec \u00b12.27% (59 runs sampled) ursus sum x 56.08 ops\/sec \u00b12.40% (59 runs sampled)  lodash sum x 8.69 ops\/sec \u00b13.36% (26 runs sampled) native reduce x 6.09 ops\/sec \u00b19.13% (20 runs sampled) for x 57.01 ops\/sec \u00b12.53% (59 runs sampled) optimized for x 57.38 ops\/sec \u00b12.64% (60 runs sampled) ursus sum x 56.12 ops\/sec \u00b12.38% (58 runs sampled)  lodash sum x 8.68 ops\/sec \u00b14.11% (26 runs sampled) native reduce x 6.06 ops\/sec \u00b19.39% (19 runs sampled) for x 69.97 ops\/sec \u00b12.82% (71 runs sampled) optimized for x 66.55 ops\/sec \u00b14.16% (68 runs sampled) ursus sum x 69.29 ops\/sec \u00b12.73% (71 runs sampled)  lodash sum x 7.86 ops\/sec \u00b18.39% (24 runs sampled) native reduce x 6.35 ops\/sec \u00b14.79% (20 runs sampled) for x 55.91 ops\/sec \u00b15.01% (58 runs sampled) optimized for x 56.41 ops\/sec \u00b12.70% (59 runs sampled) ursus sum x 57.11 ops\/sec \u00b12.16% (58 runs sampled)  lodash sum x 8.11 ops\/sec \u00b14.72% (24 runs sampled) native reduce x 5.97 ops\/sec \u00b17.80% (20 runs sampled) for x 56.43 ops\/sec \u00b13.62% (59 runs sampled) optimized for x 56.87 ops\/sec \u00b13.75% (59 runs sampled) ursus sum x 55.37 ops\/sec \u00b13.60% (58 runs sampled)  lodash sum x 8.52 ops\/sec \u00b16.70% (25 runs sampled) native reduce x 6.12 ops\/sec \u00b17.39% (20 runs sampled) for x 57.96 ops\/sec \u00b13.50% (58 runs sampled) optimized for x 55.19 ops\/sec \u00b15.32% (59 runs sampled) ursus sum x 56.75 ops\/sec \u00b13.33% (58 runs sampled)  lodash sum x 8.00 ops\/sec \u00b18.94% (25 runs sampled) native reduce x 5.75 ops\/sec \u00b16.95% (19 runs sampled) for x 56.78 ops\/sec \u00b14.21% (57 runs sampled) optimized for x 56.89 ops\/sec \u00b12.32% (60 runs sampled) ursus sum x 54.61 ops\/sec \u00b17.04% (57 runs sampled)  lodash sum x 8.11 ops\/sec \u00b18.83% (24 runs sampled) native reduce x 5.97 ops\/sec \u00b17.84% (19 runs sampled) for x 57.32 ops\/sec \u00b14.17% (59 runs sampled) optimized for x 55.97 ops\/sec \u00b14.18% (59 runs sampled) ursus sum x 55.76 ops\/sec \u00b13.90% (58 runs sampled)  lodash sum x 8.30 ops\/sec \u00b17.79% (25 runs sampled) native reduce x 6.31 ops\/sec \u00b15.42% (20 runs sampled) for x 55.45 ops\/sec \u00b15.56% (58 runs sampled) optimized for x 57.54 ops\/sec \u00b13.52% (59 runs sampled) ursus sum x 55.22 ops\/sec \u00b14.34% (57 runs sampled)<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th>\u041c\u0435\u0436\u043a\u0432. \u0421\u0440\u0435\u0434\u043d\u0435\u0435<\/th>\n<th>\u041c\u0435\u0434\u0438\u0430\u043d\u0430<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>reduce<\/td>\n<td>6.09 ops\/sec<\/td>\n<td>6.08 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>for<\/td>\n<td>57.02 ops\/sec<\/td>\n<td>56.90 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>lodash<\/td>\n<td>8.39 ops\/sec<\/td>\n<td>8.41 ops\/sec<\/td>\n<\/tr>\n<tr>\n<td>ursus<\/td>\n<td>56.20 ops\/sec<\/td>\n<td>56.10 ops\/sec<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<h4 id=\"rezultaty-gonki-2\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0433\u043e\u043d\u043a\u0438:<\/h4>\n<p>  <\/p>\n<p>1) For<br \/>  2) Ursus<br \/>  3) Lodash<br \/>  4) Reduce<\/p>\n<p>  <\/p>\n<h1 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043d\u0430 10 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 \u0440\u0430\u0437\u044b \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c for \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<blockquote><p>\u0412 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e, \u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043e\u0431\u0433\u043e\u043d\u044f\u0442\u044c lodash \u043d\u0430 50k \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0438 \u043c\u0435\u043d\u044c\u0448\u0435.<\/p>\n<p>  \u0410 \u043d\u0430 25k \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043e\u0431\u0433\u043e\u043d\u044f\u0442\u044c \u0434\u0430\u0436\u0435 for.<\/p><\/blockquote>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0432 \u0446\u0435\u043b\u043e\u043c, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442, \u043d\u043e \u0438\u043c\u0435\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u043f\u043e\u0436\u0430\u043b\u0443\u0439 \u0431\u0443\u0434\u0443, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/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\/516034\/\"> https:\/\/habr.com\/ru\/post\/516034\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/516034\/\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wv\/rq\/ig\/wvrqiglyv5qbc8wmmri0dnujz5s.jpeg\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043d\u0435\u0439 \u043d\u0430\u0437\u0430\u0434 \u044f \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b \u043f\u043e\u0441\u0442 <a href=\"https:\/\/habr.com\/ru\/post\/514716\/\">LINQ \u043d\u0430 JavaScript \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/a>. \u041d\u043e \u043c\u043e\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0443\u043f\u0430\u043b\u0430 \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0438 <a href=\"https:\/\/lodash.com\/\" rel=\"nofollow\">Lodash<\/a>. \u0412 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e, \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<\/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-308813","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308813","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=308813"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/308813\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=308813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=308813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=308813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}