webassembly
webassembly copied to clipboard
Mini benchmark example
Comparing how long it takes to add two numbers in JavaScript vs WebAssembly. Complete with simple Webpack config, NPM scripts, and Readme details.
Lemme know what ya'll thinking 😃
Overlooked some things here, I'll be making another commit. Also, WebAssembly is only faster in an async func with try/catch :)
Yeah, WebAssembly should actually be slower in this exact scenario because of the additional indirection layer (calling into a WebAssembly module and pulling something out while converting the input and output value from/to a JS number, which is a wrapped double basically), while the comparison function in plain JS will simply be JITed to efficient machine code.