Using JavaScript and WebCL for numerical computations: a comparative study of native and web technologies

From its modest beginnings as a tool to validate forms, JavaScript is now an industrial-strength language used to power online applications such as spreadsheets, IDEs, image editors and even 3D games. Since all modern web browsers support JavaScript, it provides a medium that is both easy to distribute for developers and easy to access for users. This paper provides empirical data to answer the question: Is JavaScript fast enough for numerical computations? By measuring and comparing the runtime performance of benchmarks representative of a wide variety of scientific applications, we show that sequential JavaScript is within a factor of 2 of native code. Parallel code using WebCL shows speed improvements of up to 2.28 over JavaScript for the majority of the benchmarks.

[1]  Nikolai Tillmann,et al.  Addressing JavaScript JIT Engines Performance Quirks: A Crowdsourced Adaptive Compiler , 2014, CC.

[2]  Samuel Williams,et al.  The Landscape of Parallel Computing Research: A View from Berkeley , 2006 .

[3]  Jun Li,et al.  McLab: an extensible compiler toolkit for MATLAB and related languages , 2010, C3S2E '10.

[4]  Charles Reis,et al.  Isolating web programs in modern browser architectures , 2009, EuroSys '09.

[5]  Shriram Krishnamurthi,et al.  Whalesong: running racket in the browser , 2013, DLS '13.

[6]  Jing Zhang,et al.  OpenCL and the 13 dwarfs: a work in progress , 2012, ICPE '12.

[7]  Alan Edelman,et al.  Julia: A Fast Dynamic Language for Technical Computing , 2012, ArXiv.

[8]  Martin Elsman SMLtoJs: hosting a standard ML compiler in a web browser , 2011, PLASTIC '11.

[9]  Kevin Skadron,et al.  Rodinia: A benchmark suite for heterogeneous computing , 2009, 2009 IEEE International Symposium on Workload Characterization (IISWC).

[10]  Alon Zakai Emscripten: an LLVM-to-JavaScript compiler , 2011, OOPSLA Companion.

[11]  Jan Vitek,et al.  Automated construction of JavaScript benchmarks , 2011, OOPSLA '11.

[12]  Mason Chang,et al.  Trace-based just-in-time type specialization for dynamic languages , 2009, PLDI '09.

[13]  Alex Potanin,et al.  A study of performance variations in the Mozilla Firefox web browser , 2013 .

[14]  Tatiana Shpeisman,et al.  River trail: a path to parallelism in JavaScript , 2013, OOPSLA.

[15]  Robert Hirschfeld,et al.  Efficient Layer Activation in Context JS , 2012, 2012 10th International Conference on Creating, Connecting and Collaborating through Computing.

[16]  Jan Vitek,et al.  An analysis of the dynamic behavior of JavaScript programs , 2010, PLDI '10.

[17]  Jan Vitek,et al.  Evaluating the Design of the R Language - Objects and Functions for Data Analysis , 2012, ECOOP.

[18]  Charles R. Severance JavaScript: Designing a Language in 10 Days , 2012, Computer.

[19]  Arthur Charguéraud,et al.  A trusted mechanised JavaScript specification , 2014, POPL.

[20]  Scott A. Mahlke,et al.  Dynamic parallelization of JavaScript applications using an ultra-lightweight speculation mechanism , 2011, 2011 IEEE 17th International Symposium on High Performance Computer Architecture.

[21]  Michael W. Godfrey,et al.  A reference architecture for Web browsers , 2005, 21st IEEE International Conference on Software Maintenance (ICSM'05).

[22]  Dirk Grunwald,et al.  A Methodology for Fine-Grained Parallelism in JavaScript Applications , 2011, LCPC.