Skip to content

Mini benchmark example - #8

Open
mini-eggs wants to merge 4 commits into
dcodeIO:masterfrom
mini-eggs:mini-benchmark-example
Open

mini-eggs wants to merge 4 commits into
dcodeIO:masterfrom
mini-eggs:mini-benchmark-example

Conversation

@mini-eggs

Copy link
Copy Markdown

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
Copy Markdown
Author

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

@dcodeIO

dcodeIO commented Jun 6, 2017

Copy link
Copy Markdown
Owner

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