Thread overview | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 12, 2018 Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
I like to announce Spasm https://github.com/skoppe/spasm It is a webassembly library to develop single page applications and builds on my previous work (https://forum.dlang.org/post/eqneqstmwfzugymfewqo@forum.dlang.org). It generates fast and small webassembly binaries. The example todo-mvc is only 5995 bytes (wasm) + 2199 bytes (html+js) when gzipped, and loads pretty fast (https://skoppe.github.io/spasm/examples/todo-mvc/) Spasm can be used with dub and only requires a recent version of ldc. See the readme on github how to get started. The library includes a webpack bootstrap project to build a production ready web page. Spasm is written in betterC. Next steps are: - more js host bindings (xhr, localstorage, etc.) - memory deallocation - gather an angry mob to make phobos more betterC compatible ;) |
October 12, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | On 10/12/18 3:43 PM, Sebastiaan Koppe wrote:
> I like to announce Spasm https://github.com/skoppe/spasm
>
> It is a webassembly library to develop single page applications and builds on my previous work (https://forum.dlang.org/post/eqneqstmwfzugymfewqo@forum.dlang.org).
>
> It generates fast and small webassembly binaries. The example todo-mvc is only 5995 bytes (wasm) + 2199 bytes (html+js) when gzipped, and loads pretty fast (https://skoppe.github.io/spasm/examples/todo-mvc/)
>
> Spasm can be used with dub and only requires a recent version of ldc. See the readme on github how to get started.
>
> The library includes a webpack bootstrap project to build a production ready web page.
>
> Spasm is written in betterC.
>
> Next steps are:
>
> - more js host bindings (xhr, localstorage, etc.)
> - memory deallocation
> - gather an angry mob to make phobos more betterC compatible ;)
OK, this is pretty cool. I need to start checking out webasm.
-Steve
|
October 13, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | Nifty, I'll have to look into this. Any idea what it would take to get this doing some WebGL? (Or playing audio?) Or is this more for HTML-ish sorts of stuff? What are the main current limitations? |
October 13, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Saturday, 13 October 2018 at 04:34:28 UTC, Nick Sabalausky (Abscissa) wrote: > Nifty, I'll have to look into this. Any idea what it would take to get this doing some WebGL? (Or playing audio?) Or is this more for HTML-ish sorts of stuff? This is more focused on HTML rendering, but you can do anything that you can do from JS, you just have to write JS glue code. WebGL is based on and follows the OpenGL ES (Embedded Systems) spec, which is a subset of OpenGL. So if you have the API definitions you are already half done. The other half is writing that in JS and calling the actual WebGL. If you want to do it right now you can use vladimir's dscripten-tools project, which is based on emscripten. I just don't like emscripten because it has a complex toolchain (D->LDC->(patched)LLVM->asm.js->binaryen->wasm) and results in bloated code. |
October 13, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky (Abscissa) | On Saturday, 13 October 2018 at 04:34:28 UTC, Nick Sabalausky (Abscissa) wrote:
> What are the main current limitations?
Mainly that it is written in betterC, which is quite the limitation if you are used to freely call anything from phobos, or expect the GC to clean up.
Also I currently don't free memory.
|
October 13, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | On Friday, 12 October 2018 at 19:43:25 UTC, Sebastiaan Koppe wrote:
> I like to announce Spasm https://github.com/skoppe/spasm
>
> It is a webassembly library to develop single page applications and builds on my previous work (https://forum.dlang.org/post/eqneqstmwfzugymfewqo@forum.dlang.org).
I must say even at this stage this library is awesome! Good job! Keep up with the good work! :)
|
October 14, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | On Friday, 12 October 2018 at 19:43:25 UTC, Sebastiaan Koppe wrote: > I like to announce Spasm https://github.com/skoppe/spasm > > It is a webassembly library to develop single page applications and builds on my previous work (https://forum.dlang.org/post/eqneqstmwfzugymfewqo@forum.dlang.org). > > It generates fast and small webassembly binaries. The example todo-mvc is only 5995 bytes (wasm) + 2199 bytes (html+js) when gzipped, and loads pretty fast (https://skoppe.github.io/spasm/examples/todo-mvc/) > > Spasm can be used with dub and only requires a recent version of ldc. See the readme on github how to get started. > > The library includes a webpack bootstrap project to build a production ready web page. > > Spasm is written in betterC. > > Next steps are: > > - more js host bindings (xhr, localstorage, etc.) > - memory deallocation > - gather an angry mob to make phobos more betterC compatible ;) Awesome work! I remember that, at some point the https://glimmerjs.com/ authors wanted to write their vm in rust for better performance. It looks like D is a new option for such projects. Bogdan |
October 14, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bogdan | On Sunday, 14 October 2018 at 06:03:10 UTC, Bogdan wrote:
> Awesome work! I remember that, at some point the https://glimmerjs.com/ authors wanted to write their vm in rust for better performance. It looks like D is a new option for such projects.
>
> Bogdan
Thanks, a lot of credits go to LDC for supporting the webassembly backend of LLVM.
I thought about doing a VM as well, specifically because I was afraid of the performance penalty of switching a lot between js and wasm. The idea was to emit all dom operations into one bytebuffer (possibly at compile-time) and then instruct js to execute that.
It turns out jumping between wasm and js isn't really a big deal (at least not anymore), so I ditched that idea to keep things simple.
Plus, there is a good chance that in the near future wasm will be able to call the browsers' api directly.
|
October 15, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | On Sunday, 14 October 2018 at 19:04:51 UTC, Sebastiaan Koppe wrote:
> It turns out jumping between wasm and js isn't really a big deal (at least not anymore), so I ditched that idea to keep things simple.
>
> Plus, there is a good chance that in the near future wasm will be able to call the browsers' api directly.
Precisely, that is why I like this approach. Good job.
|
October 16, 2018 Re: Spasm - webassembly libary for single page applications | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sebastiaan Koppe | On Friday, 12 October 2018 at 19:43:25 UTC, Sebastiaan Koppe wrote:
> I like to announce Spasm https://github.com/skoppe/spasm
>
> It is a webassembly library to develop single page applications and builds on my previous work
This is really interesting. I don't do web development myself and haven't been doing hobby programming, but I like the idea of of webasm.
It would be cool if D provided the easiest way to develop webasm first to see if it could claim that market.
|
Copyright © 1999-2021 by the D Language Foundation