{"id":687,"date":"2013-11-14T10:43:05","date_gmt":"2013-11-14T10:43:05","guid":{"rendered":"http:\/\/www.w3.org\/community\/forum\/?p=687"},"modified":"2013-11-14T10:43:05","modified_gmt":"2013-11-14T10:43:05","slug":"making-typed-array-processing-really-fast","status":"publish","type":"post","link":"https:\/\/www.w3.org\/community\/forum\/2013\/11\/14\/making-typed-array-processing-really-fast\/","title":{"rendered":"Making typed array processing really fast"},"content":{"rendered":"<p>Hello all,<\/p>\n<p>We all know that the computational performance of the code generated by modern ECMAScript JIT\/AOT engines is very high, and for most purposes &#8220;good enough&#8221;. In fact, I have encountered several situations where my JavaScript code runs as fast as (or even faster than) the corresponding optimized compiled C++ code (g++ -O3).<\/p>\n<p>Still, there are situations when this is not enough. For instance, in real time audio processing you want to minimize latencies and CPU load as far as possible.<\/p>\n<p>One way to increase the performance and reduce latencies is to utilize the instruction level parallelism that is available in modern CPU architectures through <a href=\"http:\/\/en.wikipedia.org\/wiki\/SIMD\" target=\"_blank\" rel=\"nofollow\">SIMD<\/a> instructions. On the other hand, it is very difficult to make use of these instructions in a platform agnostic language such as ECMAScript (see [1] and [2], for instance).<\/p>\n<p>The <a href=\"https:\/\/github.com\/RiverTrail\/RiverTrail\/wiki\" target=\"_blank\" rel=\"nofollow\">River Trail<\/a> proposal from Intel solves the parallelism issue by introducing the new data type ParallelArray, upon which fairly generic ECMAScript operations can operate. While this is a nice and quite generic solution, it adds some fairly heavy requirements on the ECMAScript compiler.<\/p>\n<p>I decided to make an attempt at creating a partial solution that is easy to integrate into current Web clients, yet powerful enough to solve many problems (especially related to signal processing).<\/p>\n<p>At this point, there is an unofficial draft <a href=\"http:\/\/opera-mage.github.io\/webarraymath\/\" target=\"_blank\" rel=\"nofollow\">specification<\/a>, and a <a href=\"https:\/\/github.com\/opera-mage\/webarraymath\" target=\"_blank\" rel=\"nofollow\">JavaScript polyfill and demos<\/a>. You can also find an open source <a href=\"https:\/\/gitorious.org\/arraymath\" target=\"_blank\" rel=\"nofollow\">C++ implementation<\/a> of most of the required functionality.<\/p>\n<p>For continuing this work, I&#8217;ve proposed the community group <a href=\"http:\/\/www.w3.org\/community\/groups\/proposed\/#webarraymath\">Web Array Math<\/a>. If you are interested in participating, feel free to support it.<\/p>\n<p>Regards,<\/p>\n<p>Marcus Geelnard, Opera Software ASA<\/p>\n<p>[1] <a href=\"http:\/\/blog.aventine.se\/post\/16318162396\/simd\" target=\"_blank\" rel=\"nofollow\">http:\/\/blog.aventine.se\/post\/16318162396\/simd<\/a><\/p>\n<p>[2] <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=644389\" target=\"_blank\" rel=\"nofollow\">https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=644389<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello all, We all know that the computational performance of the code generated by modern ECMAScript JIT\/AOT engines is very high, and for most purposes &#8220;good enough&#8221;. In fact, I have encountered several situations where my JavaScript code runs as &hellip; <a href=\"https:\/\/www.w3.org\/community\/forum\/2013\/11\/14\/making-typed-array-processing-really-fast\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":5485,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-687","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/posts\/687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/users\/5485"}],"replies":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/comments?post=687"}],"version-history":[{"count":3,"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/posts\/687\/revisions"}],"predecessor-version":[{"id":690,"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/posts\/687\/revisions\/690"}],"wp:attachment":[{"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/media?parent=687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/categories?post=687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.w3.org\/community\/forum\/wp-json\/wp\/v2\/tags?post=687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}