Skip to content

Conversation

@mini-eggs
Copy link

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 😃

@mini-eggs
Copy link
Author

Overlooked some things here, I'll be making another commit. Also, WebAssembly is only faster in an async func with try/catch :)

@dcodeIO
Copy link
Owner

dcodeIO commented Jun 6, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants