Measuring Acceleration of WebGPU for JavaScript

Authors

  • Krish Jana Department of Computer Science, George Mason University, Fairfax, VA
  • Helen Qin Department of Computer Science, George Mason University, Fairfax, VA
  • Sthitadhi Sengupta Department of Computer Science, George Mason University, Fairfax, VA
  • Nan Wu Department of Computer Science, George Mason University, Fairfax, VA
  • Bo Han Department of Computer Science, George Mason University, Fairfax, VA

Abstract

In the field of computer science, optimizing the execution time of computational tasks is essential for enhancing
the performance of web applications. This study investigates the performance of WebGPU, a cross-platform graphics API designed for efficient GPU utilization. Traditional JavaScript and JavaScript leveraging WebGPU (JS + WebGPU) are
compared for various computational tasks. The primary focus is on matrix multiplication, vector addition, and
matrix-vector multiplication, where execution time is a critical factor. Benchmarking tests were conducted to evaluate the execution times of JavaScript and JS + WebGPU across different input sizes. Our measurement results showed for two matrix multiplication operations (2mm), JS + WebGPU exhibited a substantial performance improvement for larger inputs, reducing execution time from 6.836 seconds to 1.227 seconds for large (L) inputs and from 100.78 seconds to 1.621 seconds for extra-large (XL) inputs, compared to JavaScript alone. Similarly, for vector addition, JS + WebGPU outperformed JavaScript significantly for larger inputs, with execution times decreasing from 7.364 seconds to 1.082 seconds for XL inputs. In matrix-vector multiplication, JS + WebGPU also demonstrated superior performance, reducing execution times from 3.291 seconds to 0.752 seconds for L inputs and from 51.358 seconds to 1.011 seconds for XL inputs. These results highlight the potential of WebGPU to enhance computational efficiency, particularly for large-scale operations, by leveraging GPU capabilities. The study's findings suggest that integrating WebGPU with JavaScript can lead to substantial reductions in execution time with input sizes (growth in dimensions of matrices and vectors), offering significant implications for the development of high-performance web applications.

Published

2024-10-13

Issue

Section

College of Engineering and Computing: Department of Computer Science