Running physics in a webworker

Well. Unfortunately I don’t have any simple examples at hand. Only bigger custom projects. I’ve had a hard time choosing whether or not to use workers for my physics. You see, first of all it adds some complexity to the code, but secondly, the messaging system between the main thread and workers isn’t as real-time as one would think. The transfer speed of messages is fast, but sending the message doesn’t seem to be instantaneous.
You can use interpolation between updates, but that just seems a bit wrong.
Use SharedArrayBuffers if supported, else use transferables if supported(remember to send this array back and forth to prevent recreation), else use normal cloning with postMessage.
Using object cloning and postMessage is perfectly fine for most things including sending inputs, corrections, new objects to be created etc. But any big arrays that might change every frame should if possible, use SharedArrayBuffers or transferables.

Make a PG so we can play around with it a little.