Performance Benefits of Extending JavaScript Through WASM and CUDA : A Comparative Performance Investigation

University essay from KTH/Skolan för elektroteknik och datavetenskap (EECS)

Author: Hampus Hallkvist; Edvin Nordqvist; [2023]

Keywords: ;

Abstract: JavaScript is today the largest language based on usage with regard to web development. There is, therefore, a great incentive to make the language perform at its best and allow applications to take advantage of this. Despite this, there is yet to be a well-established method of taking full advantage of the GPU and the great potential of heterogeneous computing via JavaScript. This study aims to explore the performance potential of a theoretical GPU binding for heterogeneous computing with JavaScript. It does this by comparing and exploring it alongside an already budding technology in WebAssembly that provides a JavaScript binding for the exploitation of more optimized programming languages such as C/C++. As such the study compared the execution times of a set of well-known algorithms representative of common general computing through a custom benchmark suite in JavaScript/TypeScript. The benchmark measured three different channels for each algorithm, one for each technology: JavaScript (the bar for performance), WebAssembly in conjunction with C/C++, and CUDA. The study showed uncertain and mostly inconsistent results for the performance of WebAssembly as compared to JavaScript. But in general, the results showed a slight performance boost for WebAssembly depending on the algorithm. Previous research, however, shows substantial reliable improvement through WebAssembly and the results of this study could therefore be representative of limitations in the optimization of the study’s WebAssembly benchmark. CUDA on the other hand showed extremely promising results with great speedup in conjunction with heavier computational load. With this said, whilst the result showcased promising speedup for CUDA, the CUDA implementation in this project was built through custom third-party bindings to each executable. As such the results for CUDA were highly theoretical but show great potential as a lower bound for what performance can be expected from a fully-fledged binding to JS for heterogeneous computing. As such the study concludes that whilst the CUDA results are highly theoretical and might not be fully born out in reality, the integration of a heterogeneous computing tool is worth investigating, researching, and developing further.

  AT THIS PAGE YOU CAN DOWNLOAD THE WHOLE ESSAY. (follow the link to the next page)