badboy / hellorust Goto Github PK
View Code? Open in Web Editor NEWCollection of resources & examples for Rust & WebAssembly
Home Page: https://www.hellorust.com/
License: Creative Commons Zero v1.0 Universal
Collection of resources & examples for Rust & WebAssembly
Home Page: https://www.hellorust.com/
License: Creative Commons Zero v1.0 Universal
It would be nice to update the example which shows the usage of imported memory and show how to use it for passing arrays into webassembly and getting the result back. Would be an interesting and useful example I think (quite a common use case).
It's clear that the one can simply export alloc()
and dealloc()
functions from Rust and then use them in JavaScript to allocate memory, fill it and pass the pointer to Rust, but it would be also interesting to see how to do the same with the imported memory (I believe in this case it saves the caller from explicitly calling alloc()
function, but I'm not sure about that)
I tried to follow this guide, but it seems to have some issues.
First "rustup update" will only update what is already installed, if the correct (platform dependent) nightly toolchain hasn't already been installed this won't do the trick, so next step will fail.
Second, rustc does not seem to recognise +nightly as a command, I haven't figured what the right thing to put instead is, so this is where I'm stuck.
Ok, that was a messup with two different installs, looks like I got it working.
I'm on 64-bit Windows 7 by the way.
Hi!
Thank you for the site.
https://www.hellorust.com/demos/sha1/index.html demo doesn't work. Digest is always "Digest will be shown here" regardless of input. Tried FF + win10, Chrome + MacOS.
http://webassembly.org/demo/Tanks/ works fine.
Do things faster and better with WebAssembly
by Sendilkumarn at Codemotion Rome & Amsterdam JS
When: 2018-04-13, 2018-03-29
Material:
It seems to me that Rust will pick a random type for the element of the vector you are creating in the alloc
function:
hellorust/demos/factorial/factorial.rs
Lines 6 to 10 in 3b0d1c9
I am actually surprised that it compiles, since the element of the vector could be anything. Swapping line 7 by let mut buf = Vec::<u64>::with_capacity(size);
or let mut buf = Vec::<()>::with_capacity(size);
still compiles. I am wondering, which type is Rust choosing when you leave it up to inference? Are you sure it is u8
?
No idea whether they are in any way production ready, but a post giving an overview over what tools exist to integrate Rust into a JS-based build:
(feel free to extend this list)
I'm not sure if this is the sort of demo you're interested in, but I threw this together and was pleasantly surprised by how good the performance of the wasm'd rust was. On my machines, it's several times faster, with the lead increasing as input sizes grow. Firefox's wasm runtime seems a step ahead of Chrome's, also.
Since the content of the hellorust.com (and all examples) is intended to be copied freely, it would be better licensed CC0, with basically no restrictions.
This applies only to the code in the examples; libraries in use will have their own license.
We will track here the consent of all contributors:
Please drop a comment here if you consent or disagree. Link to CC0 license. Once we gather consent following will be merged: #22
Compare size of asm.js(+emscripten), Wasm(+emscripten), Wasm(bare). Maybe even C program (will win for simple things).
Currently, the value is stored as an i32. It can only hold values from ~±2*10^10, hence store factorials <= fact(12). Everything above will overflow. This can be observed by the naked eye when computing factorial 17 and 18, as they'll go negative :D
I see two options - use an i64 as datatype or restrict to factorials <=12 instead of 20.
What is the license of this repo, please? :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.