Spasm - webassembly libary for single page applications

Sebastiaan Koppe mail at skoppe.eu
Thu Oct 18 07:25:57 UTC 2018


On Wednesday, 17 October 2018 at 19:07:16 UTC, aberba wrote:
> A common use case for wasm is to port C++ native apps to web. 
> e.g. is the recent autoCAD web app which does almost everything 
> the desktop app can. That's the only reason to IMO do stuff in 
> wasm. Games, productivity software, etc...performance. Spasm 
> might just be perfect for that kind of stuff

There are issues getting the current GC ported to webassembly, so 
it is hard to port D code to wasm. That is one of the reasons why 
spasm has taken the betterC approach.

But remember, spasm is just a library to render and update html, 
and to respond to dom events. It won't help you in anyway to port 
something to wasm.

If you really want to port existing D code to wasm you either 
need to rewrite that in betterC or port druntime, which includes 
writing a precise GC. Dscripten-tools is a move in that direction.

The reason spasm exists is because I wanted to optimise web 
application's rendering code at compile-time, to reduce the 
runtime (setup) costs and to deliver high performant web 
applications.

I first tried to do that by writing a javascript optimiser that 
can take React code as input and spit out highly optimised js 
code. I got pretty far with that but at one point I realised that 
to do it well I needed advanced things like data-flow analysis 
and abstract interpretation. So I decided to ditched that and 
just use D's static introspection and LLVM's wasm target. A 
couple of weeks after that spasm was born.


More information about the Digitalmars-d-announce mailing list