-
Notifications
You must be signed in to change notification settings - Fork 208
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
Using wasm to accelerate PixelManipulation.js #1093
Changes from 17 commits
2019622
1ea2d20
f7f8f3a
2f4066f
6a60840
f6a4104
8c22f33
b640aaf
7f2fadb
d78c587
c41bb33
9da895f
afc42c5
15c495e
0ea5419
6b21435
c129de1
adca670
5b8b365
5c7c2ba
4ae1d4a
a3821c0
320dcb3
371b11d
133673a
466ecf8
8e2c1dc
4419730
cf91655
1e9f741
5c19488
c89bfe4
317c2ae
bafdfcb
e45da7d
11f24a5
4aefec1
0358835
32ec906
1e4ba0d
1e1ac72
14ea03f
6f4fc3b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -578,3 +578,22 @@ sequencer2.run(); | |||||
This method returns an object which defines the name and inputs of the modules. If a module name (hyphenated) is passed in the method, then only the details of that module are returned. | ||||||
|
||||||
The `notify` function takes two parameters `msg` and `id`, former being the message to be displayed on console (in case of CLI and node ) and a HTML component(in browser). The id is optional and is useful for HTML interface to give appropriate IDs. | ||||||
|
||||||
## Using WebAssembly for heavy pixel processing | ||||||
|
||||||
As of now, any of the modules, which uses changePixel function uses wasm as well. Both node and browser code use WebAssembly and the only region of fallback to the initial code is the one under browserified unit tests. | ||||||
|
||||||
The main advantage we get using wasm is blazing fast speed attained in processing pixels for many modules that is very clear from the benchmarks itself. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks!! |
||||||
|
||||||
The only limitation encountered was that the browser and node code for implementing wasm had to be written separately. This is because in browser we use ```fetch``` and in node we use ```fs``` module which both can't be used in other environment. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks!! |
||||||
|
||||||
Also, one can toggle between the two modes, the wasm one and the non-wasm in the following way: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ this is accurate, right? Or have we made it default off? I think probably best to have it default on, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing now!! |
||||||
|
||||||
```js | ||||||
let sequencer = ImageSequencer({useWasm:true}) // for wasm mode or | ||||||
|
||||||
let sequencer = ImageSequencer({useWasm:false}) //for non-wasm mode or simply | ||||||
|
||||||
let sequencer = ImageSequencer() // also for non-wasm mode | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we make the default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok sure!! |
||||||
|
||||||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you link to the browerified unit tests you're referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing now!!