skip to main content
research-article

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

Published:14 October 2014Publication History
Skip Abstract Section

Abstract

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.

References

  1. asm.js. URL http://asmjs.org/spec/latest/.Google ScholarGoogle Scholar
  2. Cascading style sheets (CSS) snapshot 2010. URL http://www.w3.org/TR/css-2010/.Google ScholarGoogle Scholar
  3. dart2js. URL https://www.dartlang.org/tools/dart2js.Google ScholarGoogle Scholar
  4. Emscripten. URL http://emscripten.org.Google ScholarGoogle Scholar
  5. Google web toolkit. URL http://www.gwtproject.org/.Google ScholarGoogle Scholar
  6. A vocabulary and associated APIs for HTML and XHTML. URL http://www.w3.org/TR/html5/.Google ScholarGoogle Scholar
  7. Standard ECMA-262 ECMAScript language specification edition 5.1 (june 2011). URL http://www.ecma-international.org/publications/standards/Ecma-262.htm.Google ScholarGoogle Scholar
  8. Kraken Benchmark Suite. URL http://krakenbenchmark.mozilla.org/.Google ScholarGoogle Scholar
  9. Octane Benchmark Suite. URL https://developers.google.com/octane/.Google ScholarGoogle Scholar
  10. Opal: Ruby to JavaScript compiler. URL http://opalrb.org/.Google ScholarGoogle Scholar
  11. OpenCL. URL https://www.khronos.org/opencl/.Google ScholarGoogle Scholar
  12. Pyjs. URL http://pyjs.org/.Google ScholarGoogle Scholar
  13. Profile your web application with v8's internal profiler. URL https://developers.google.com/v8/profiler_example.Google ScholarGoogle Scholar
  14. WebGL specifications. URL http://www.khronos.org/registry/webgl/specs/latest/.Google ScholarGoogle Scholar
  15. WebCL specification. May 2014. URL http://www.khronos.org/registry/webcl/specs/latest/1.0/.Google ScholarGoogle Scholar
  16. K. Asanovic, R. Bodik, B. C. Catanzaro, J. J. Gebis, P. Husbands, et al. The landscape of parallel computing research: A view from berkeley. Technical Report UCB/EECS-2006-183, EECS Department, University of California, Berkeley.Google ScholarGoogle Scholar
  17. R. Auler, E. Borin, P. de Halleux, M. Moskal, and N. Tillmann. Addressing JavaScript JIT Engines Performance Quirks: A Crowd- sourced Adaptive Compiler. In CC.(2014).Google ScholarGoogle Scholar
  18. L. Bak. Google chrome's need for speed. URL http://blog.chromium.org/2008/09/google-chromes-need-for-speed_02.html.Google ScholarGoogle Scholar
  19. J. Bezanson, S. Karpinski, V. B. Shah, and A. Edelman. Julia: A Fast Dynamic Language for Technical Computing. CoRR, abs/1209.5145, 2012.Google ScholarGoogle Scholar
  20. M. Bodin, A. Chargueraud, D. Filaretti, P. Gardner, et al. A Trusted Mechanised JavaSript Specification. In POPL.(2014). Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. A. Casey, J. Li, J. Doherty, M. C. Boisvert, T. Aslam, et al. McLab: An Extensible Compiler Toolkit for MATLAB and Related Languages. In C3S2E.(2010). Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. S. Che, M. Boyer, J. Meng, D. Tarjan, et al. Rodinia: A benchmark suite for heterogeneous computing. In IISWC.(2009). Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. J. Coglan. Sylvester: Vector and Matrix math for JavaScript.Google ScholarGoogle Scholar
  24. P. Colella. Defining software requirements for scientific computing, 2004.Google ScholarGoogle Scholar
  25. J. de Jong. math.js. URL http://mathjs.org/.Google ScholarGoogle Scholar
  26. M. Elsman. SMLtoJs: Hosting a standard ML compiler in a web browser. In PLASTIC.(2011). Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. W. C. Feng, H. Lin, T. Scogland, and J. Zhang. OpenCL and the 13 Dwarfs: A Work in Progress. In ICPE.(2012). Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. J. Fifield and D. Grunwald. A Methodology for Fine-Grained Parallelism in JavaScript Applications. In Languages and Compilers for Parallel Computing, volume 7146 of LNCS, pages 16--30. 2013.Google ScholarGoogle ScholarCross RefCross Ref
  29. A. Gal, B. Eich, M. Shaver, D. Anderson, et al. Trace-based Just-in- time Type Specialization for Dynamic Languages. In PLDI.(2009). Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Grosskurth and M. W. Godfrey. A Reference Architecture for Web Browsers. In ICSM.(2005). Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. S. Herhut, R. L. Hudson, T. Shpeisman, and J. Sreeram. River Trail: A Path to Parallelism in JavaScript. In OOPSLA.(2013). Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. R. Krahn, J. Lincke, and R. Hirschfeld. Efficient Layer Activation in Context JS. In C5.(2012). Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. J. Larres, A. Potanin, and Y. Hirose. A Study of Performance Variations in the Mozilla Firefox Web Browser. In ACSC.(2013). Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. S. Loisel. Numeric Javascript. URL http://numericjs.com/.Google ScholarGoogle Scholar
  35. M. Mehrara, P.-C. Hsu, M. Samadi, and S. Mahlke. Dynamic parallelization of JavaScript applications using an ultra-lightweight speculation mechanism. In HPCA.(2011). Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. L. A. Meyerovich, M. E. Torok, E. Atkinson, and R. Bodík. Super-conductor: A Language for Big Data Visualization, 2013.Google ScholarGoogle Scholar
  37. F. Morandat, B. Hill, L. Osvald, and J. Vitek. Evaluating the Design of the R Language: Objects and Functions for Data Analysis. In ECOOP.(2012). Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. F. Pizlo. JetStream Benchmark Suite. URL https://www.webkit.org/blog/3418/introducing-the-jetstream-benchmark-suite/.Google ScholarGoogle Scholar
  39. C. Reis and S. D. Gribble. Isolating Web Programs in Modern Browser Architectures. In EuroSys.(2009). Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. G. Richards. JSBench Benchmark Suite. URL http://jsbench.cs.purdue.edu/.Google ScholarGoogle Scholar
  41. G. Richards, A. Gal, B. Eich, and J. Vitek. Automated Construction of JavaScript Benchmarks. In OOPSLA.(2011), . Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. G. Richards, S. Lebresne, B. Burg, and J. Vitek. An analysis of the dynamic behavior of javascript programs. In PLDI.(2010), . Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. C. Severance. JavaScript: Designing a language in 10 days. Computer, 45(2):7--8, Feb. 2012. ISSN 0018-9162. . Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. D. Yoo and S. Krishnamurthi. Whalesong: Running racket in the browser. In DLS.(2013). Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. A. Zakai. Emscripten: An LLVM-to-JavaScript compiler. In OOPSLA.(2011). Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

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

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!