-
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
Add explaination of the raw wasm module #42
Conversation
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.
Thanks for cleaning a lot of this stuff up @alfiedotwtf :)
I have a few nitpicks inline below that we should fix before merging. Also some things that I think @ashleygwilliams or @mgattozzi should sign off on regarding the wasm-pack
tutorial bits.
Thanks!
src/game-of-life/implementing.md
Outdated
cell is dead or alive, respectively. By working with pointers and overlays, we | ||
avoid copying the cells across the boundary on every tick. | ||
We can directly access WebAssembly's linear memory via `memory`, which is | ||
defined in the raw wasw module `wasm_game_of_life_bg`. To draw the cells, we |
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.
typo: "wasw"
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.
Doh!
src/game-of-life/setup.md
Outdated
have to worry about it too much and just write Rust code for the most part. If | ||
you want to know the full extent of its capabilities check out the README on | ||
its repo which can be found | ||
[here](https://github.com/alexcrichton/wasm-bindgen). For our purposes we need |
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.
nitpick: the canonical repo is https://github.com/rustwasm/wasm-bindgen now
src/game-of-life/setup.md
Outdated
you want to know the full extent of its capabilities check out the README on | ||
its repo which can be found | ||
[here](https://github.com/alexcrichton/wasm-bindgen). For our purposes we need | ||
to know that if we want functions to work with wasm easily we'll need it. |
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.
This last sentence isn't very clear to me.
In fact, I think we can replace these first two paragraphs with simply:
> We will use [wasm-bindgen](https://github.com/rustwasm/wasm-bindgen) to
> communicate between Rust/wasm and JavaScript. `wasm-bindgen` currently
> relies on nightly-only features (`proc_macro`, etc...) that we must opt
> into using.
I want to keep the intro very short and to the point because people bounce off of walls of text, especially when first getting started before they are hooked.
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.
Ack.
src/game-of-life/setup.md
Outdated
[here](https://github.com/alexcrichton/wasm-bindgen). For our purposes we need | ||
to know that if we want functions to work with wasm easily we'll need it. | ||
|
||
The `extern crate` call lets the compiler know what crates to link in and the |
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.
nitpick: "call" is not the right word here, because it isn't a function or method.
We could either completely drop it, or replace with "declaration".
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.
I agree to removing this.
src/game-of-life/time-profiling.md
Outdated
@@ -28,8 +28,8 @@ Calling `performance.now` has very little overhead, so we can create simple | |||
measurements from it without distorting the performance of the rest of the | |||
system. | |||
|
|||
For example, we can create a simple FPS counter that we update on each iteration | |||
of our `renderLoop`: | |||
For example, we can create a simple FPS (frames per second) counter that we |
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.
Let's flip this to "frames per second (FPS)"
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.
Ack
src/wasm-pack/rust-code.md
Outdated
prelude from `wasm-bindgen`. The `extern crate` call lets the compiler know what crates to link in | ||
and the `prelude` contains all the types and functions that `wasm-bindgen` needs to work properly! | ||
|
||
Cool let's import the `alert` function from JS so that we can call it in our Rust code! |
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.
I'm unsure whether we want to remove all this and what level of wasm-bindgen
familiarity the wasm-pack
tutorial is expecting.
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.
Cool. I've put them back in.
I think that's everything. Let me know if you find anything else needing changes 👍 |
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.
LGTM, thanks @alfiedotwtf!
Would still like to hold off on merging before @ashleygwilliams signs off on the wasm-pack tutorial changes.
I've dropped the wasm-pack tutorial commits, so that the rest can be merged. I'll submit a separate PR for them so that these don't go stale. |
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.
Thanks @alfiedotwtf :)
In reference to #38