BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News JavaScript Extension that Adds Parallel Processing Capabilities Unveiled by Intel

JavaScript Extension that Adds Parallel Processing Capabilities Unveiled by Intel

Leia em Português

This item in japanese

Bookmarks

JavaScript, the language that powers the Web, has mainly remained sequentially, although parallel processing capabilities are currently available even on mobile devices. Intel Labs has been working on an extension of JavaScript that takes advantage of multi-core systems and has released a Firefox plugin.

These parallel extensions for JavaScript, code named River Trail, is an Intel Labs project which tries to bring the processing power of Intel’s multi-core CPUs and their vector extensions to web applications. River Trail will try to make possible more compute intensive applications like photo editing, inside the browser.

Integration with existing web technologies was a major consideration, as Stephan Herhut from Intel Labs mentions:

What really excites me about the technology behind River Trail is its seamless integration with existing web technologies. River Trail extends JavaScript with a simple, yet powerful data-parallel programming model. Much effort was spent to make this extension feel as natural as possible. Our goal was to make writing web applications with River Trail as easy as writing regular JavaScript. Furthermore, as River Trail is embedded into JavaScript, it combines well with other upcoming HTML5 APIs. We in particular made sure that River Trail plays nicely with WebGL, a recently introduced JavaScript API to OpenGL used for 3D visualization in the browser: One of our demo applications is a physics simulation with more than 4000 bodies, where the computation is done using River Trail and visualization is performed with WebGL.

River Trail extends JavaScript with deterministic data-parallel constructs that are translated at runtime into a low-level hardware abstraction layer. By leveraging multiple CPU cores and vector instructions, River Trail is claimed to achieve significant speedup over sequential JavaScript.

In particular, it adds the ParallelArray data type to JavaScript. This is a read only data structure holding the actual Parallel Array data that is created by a call to a constructor or is returned from a call to one of the ParallelArray prototype methods. Input to the constructor is typically a JavaScript array, a typed array, or a function that is used to generate the ParallelArray’s values. For example “new ParallelArray([1,2,3])” would create a ParallelArray holding the values 1, 2, and 3.  The result could be a ParallelArray holding the values 1, 2, and 3, which is accessible by functions like combine, filter, map, reduce, etc. which perform work in parallel! JavaScript functions provided to them are compiled to OpenCL. These functions can use a subset of JavaScript.

River Trail is available today as an add-on to the Firefox web browser.

Rate this Article

Adoption
Style

BT