Debugging rust/wasm at 60fps

  1. I’m writing a wasm32 app in Rust.

  2. Generally, I’m a big fan of printf debugging.

  3. Printf debugging really doesn’t work very well when inserted in some call that is called 60 times per second.

  4. I think a better way to debug this is to pop up some external web browser window/frame, to have some DOM elements in that window/frame (so this way that DOM element is being rewritten 60 times per second instead of console log being spammed 60 times per second).

  5. I’m sure others have run into this problem before me. Is there some library I can use for this?

If you’re updating a text element that fast, it’s going to look very jittery and hard to read… so you might want to have a delayed timer that only changes the display at a comfortable rate.

Alternatively you could have a visual indicator to go alongside the text… here’s an example of a progress bar with a number value changing every tick (via dat.gui - it’s the controller in the top-right corner):

http://workshop.chromeexperiments.com/examples/gui/#10--Updating-the-Display-Manually

(this is all on the JS side)