Discuss Scratch

ScratchBrother123
Scratcher
100+ posts

Compile to webassembly

Is it possibile to compile scratch projects to webassembly, or is anyone interested about it?
applejuiceproduc
Scratcher
1000+ posts

Compile to webassembly

It looks like using this you can convert JavaScript to web assembly, and you can convert scratch to JavaScript using turbo warp packager or leapord.Ja so it should work?

A signature
davidtheplatform
Scratcher
500+ posts

Compile to webassembly

ScratchBrother123 wrote:

Is it possibile to compile scratch projects to webassembly, or is anyone interested about it?
Im working on a thing that does this it might be ready soon (but probably not)

Generation 4: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
ajskateboarder
Scratcher
1000+ posts

Compile to webassembly

What benefits would you get out of compiling Scratch code to WebAssembly? Scratch uses WebGL 1.0 for the GUI, so you won't get much rendering performance by using WASM
Pufferfish_Test
Scratcher
500+ posts

Compile to webassembly

I'm currently working on this - see https://github.com/hyperquark/hyperquark

This is my signature, and appears below eeevvvveeerrrryyy post I write
Try out Ocular



Good evening. I am a gerbil. Are you a gerbil? I know I am. Gerbils are possibly the most important beings in the universe; they are super intelligent and they eat carrots so we don't have to.
If you are reading this, you're probably thinking one of 3 things:
  1. This dude's not a gerbil, he's a pufferfish/human/bison/whatever other organism/inanimate object you mistakenly believe I am.
  2. Why am I reading this????????
  3. I'm hungry
The first one is INCORRECT, and I'm going to have to ask you not to spread that false rumour.
The second one is a valid question, and one that has no satisfactory answer other than that you're really ,really, really bored.
As for the 3rd one - so am I. You're not alone.
davidtheplatform
Scratcher
500+ posts

Compile to webassembly

ajskateboarder wrote:

What benefits would you get out of compiling Scratch code to WebAssembly? Scratch uses WebGL 1.0 for the GUI, so you won't get much rendering performance by using WASM
It isn't an interpreter written in WASM, it converts Scratch code to native C++ code, which speeds up the actual code.

Pufferfish_Test wrote:

I'm currently working on this - see https://github.com/hyperquark/hyperquark
there are now 5 things that compile scratch to C++/rust now

Generation 4: the first time you see this copy and paste it on top of your sig in the scratch forums and increase generation by 1. Social experiment.
ajskateboarder
Scratcher
1000+ posts

Compile to webassembly

davidtheplatform wrote:

ajskateboarder wrote:

What benefits would you get out of compiling Scratch code to WebAssembly? Scratch uses WebGL 1.0 for the GUI, so you won't get much rendering performance by using WASM
It isn't an interpreter written in WASM, it converts Scratch code to native C++ code, which speeds up the actual code.
I was talking to the OP
Pufferfish_Test
Scratcher
500+ posts

Compile to webassembly

davidtheplatform wrote:

(#6)

Pufferfish_Test wrote:

I'm currently working on this - see https://github.com/hyperquark/hyperquark
there are now 5 things that compile scratch to C++/rust now
mine doesn't compile to rust but ok

ajskateboarder wrote:

(#4)
What benefits would you get out of compiling Scratch code to WebAssembly? Scratch uses WebGL 1.0 for the GUI, so you won't get much rendering performance by using WASM
things that I hope to get out pf using WASM:
  • if the types of variables can be statically determined then most operations should be a bit faster than in js
  • if not but you can make a pretty good guess then you could utilise branch hinting (currently available in safari & chrome behind a flag) which would hopefully improve things
  • if you've got clones doing the same thing as each other each tick SIMD may be usable (although probably not)
  • most importantly, wasm's performance is fairly predictable across browsers, unlike js which tends to be slower in ff - so the largest performance increass would probably be seen in ff
of course js JIT engines are really good these days so there's a chance that there won't be any improvement at all

also i'd assume that graphics wouldn't gain any performance boost from using wasm, webgl will almost certainly be faster - however of course there is overhead from wasm<–>js interop so using wasm could just make everything slower… but then again copying data to and from the gpu is already expensive

This is my signature, and appears below eeevvvveeerrrryyy post I write
Try out Ocular



Good evening. I am a gerbil. Are you a gerbil? I know I am. Gerbils are possibly the most important beings in the universe; they are super intelligent and they eat carrots so we don't have to.
If you are reading this, you're probably thinking one of 3 things:
  1. This dude's not a gerbil, he's a pufferfish/human/bison/whatever other organism/inanimate object you mistakenly believe I am.
  2. Why am I reading this????????
  3. I'm hungry
The first one is INCORRECT, and I'm going to have to ask you not to spread that false rumour.
The second one is a valid question, and one that has no satisfactory answer other than that you're really ,really, really bored.
As for the 3rd one - so am I. You're not alone.

Powered by DjangoBB