Jesper

@Jespertheend
153 Followers
50 Following
222 Posts
Happy Halloween!

So in conclusion. The actual functional piece of code seems to be running roughly x2.8 times as fast! But with all the extra overhead it's more like x1.25 as fast sadly.

The (unminified) js file is 4.7kB, whereas the wasm + gluecode takes up 31.5kB. So I think the trade-off is probably not worth it for our case.

I decided to put more time into this for some reason. I rewrote the hot path (again) in js but this time closely mimicking the way it was implemented in rust.
The js version takes significantly longer, but if you ignore serialization (which you typically only need with wasm), it's starting to get a lot closer to what rust can achieve.
Also note the big gap at the start of the wasm runs, god knows what the cpu is doing there.
Note though that this was not really rust's fault and neither was it wasm's. Basically my algorithm creates a whole bunch of `new BoxCollider()` instances as it is running, so the hot path turned out to be a lot less 'hot' than I thought.

I just spent two days (🥲) rewriting a hot path in rust to see how much better it would perform using wasm. The answer: Not at all!

I'm kind of sad I'm not getting my magical performance boost, but otoh I don't have to maintain an extra piece of tooling in my codebase now, so that's gotta be worth something.

There's nothing quite like searching for existing issues while submitting a bug report, only to find out you yourself submitted that very bug a few years ago.

It's kinda liberating to have a side project which is:
A. Not getting enough traffic to warrant supporting every browser, and
B. Too advanced for Safari anyway

Left: Renda Studio in Chrome
Right: Renda Studio in Safari

- Note the lack of WebGPU support
- the logo (which is just an svg) not rendering correctly
- 'open project' being greyed out due to lack of the File System Access API
- and the 'update' button not going away for some reason.

False alarm! It turns out it was, in fact, a triangle which had partially clipped with one of the clipping panes!
Drawing your first triangle drawn is notoriously difficult.
I tried getting a triangle drawn, but I actually got a quad?!

A function that allows you to convert a 2d vector into a single byte and back into a vector. Useful when you want to send player joystick input over the network.

Play with it here:
https://www.desmos.com/calculator/zpob0tj445

And code can be found here:
https://gist.github.com/jespertheend/53cddb4a15055d63ab2a9c0585265eda

vec2 to byte and back

Desmos