Electric Field Simulator and Art Creator

Hi, after some fiddling I managed to do some serious optimization by porting calculation to web assembly compiled from Rust. Here’s the wasm version. Oh god, the speed is at least doubled. However, I experience some weird quirks while dragging and local storage stopped working. Maybe it’s because of the service worker I used for a progressive web app? Or is there any race condition between subscriptions and commands back and force between elm, js, and rust? I have trouble locating the issue. Can someone help?

repo: https://github.com/AlienKevin/electric-fields-with-rust

BTW: Now we support simulating electric forces as well.

Here’s a very crude visual speed comparison:
Pure Elm:
19625d2979da574c13b753e1649b0ef8

Elm with WASM compiled from Rust:
9f95c3030a7395a5b97ef472a7341f36

2 Likes