Measuring Acceleration of WebGPU for JavaScript
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
Issue
Section
License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.