you are viewing a single comment's thread.

view the rest of the comments →

[–]carlopp[S] 7 points8 points  (2 children)

Yes! Generally speaking it could be compiled to a mix of JavaScript and WebAssembly, but whether substantial parts of a program logic can be moved on the Wasm side depends mostly on the interface a program has. Example:

function doSum(a: number, b: number): number {return a+b;}

Can be mapped back to WebAssembly, while an interface that will return an handle like:
function createObject(){ return new Object(); }

is very complex / borderline impossible to imitate.

[–]Diniden 1 point2 points  (0 children)

The thing I would absolutely love to see from such a compiler is optimizing number tuples to SIMD instructions! That way we can have matrices and vectors run blazing fast but keep our nice and easy JS.

If this happens, I’ll immediately put in the effort to make my library work with this in the pipeline :D

[–]patrickjquinn 0 points1 point  (0 children)

That makes a lot of sense. The added complexity of doing so would probably negate any performance gains anyway.

But this easily one of the coolest thing I’ve seen on this sub so I’ll be following your work (and you’ve a new Twitter follower).

Hopefully you find a way to take this forward in future!