JSMP: Enabling Parallel Programming in JavaScript with Directives

碩士 === 國立交通大學 === 資訊科學與工程研究所 === 105 === JavaScript is a dynamic language that is designed to be flexible and light-weight. It is widely used in modern web applications not only for user interface manipulation but also computation-intensive tasks. Many optimization techniques, such as just-in-time c...

Full description

Bibliographic Details
Main Authors: Tsai, Chih-Hao, 蔡志豪
Other Authors: You, Yi-Ping
Format: Others
Language:en_US
Published: 2017
Online Access:http://ndltd.ncl.edu.tw/handle/79475571811562850870
Description
Summary:碩士 === 國立交通大學 === 資訊科學與工程研究所 === 105 === JavaScript is a dynamic language that is designed to be flexible and light-weight. It is widely used in modern web applications not only for user interface manipulation but also computation-intensive tasks. Many optimization techniques, such as just-in-time compilation, were applied to JavaScript engines for better performance. However, JavaScript concurrency is less addressed in the literature. A standard way to utilize multi-core CPUs in JavaScript is using Web Worker, which is a message-passing-based API for spawning background scripts to achieve parallelism. Nevertheless, message passing can be more difficult to program than shared memory. In this paper, we present an API, called $JSMP$, which involves a set of compiler directives and runtime routines for JavaScript with compiler directives for shared memory multiprocessing programming in JavaScript. We implemented a compiler that translates directive-annotated JavaScript programs to Web Worker-based JavaScript programs, which can be executed in most modern web browsers and a runtime library for running JSMP routines. Our evaluation shown that the proposed framework enabled parallel processing of JavaScript programs on multi-core CPU architectures. Our framework improved the performance of JavaScript programs with an average of 2.8x (geometric mean) speedup on a quad-core processor.