Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mini benchmark example #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Mini benchmark example #8

wants to merge 4 commits into from

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