Optimising RemGlk-rs

I’ve started working on improving the file size of Emglken’s wasm files.

  1. Moving the unicode buffer functions to JS saved 330kb from Glulxe/Git.
  2. Disabling the “std” feature for the Jiff library cut 48kb from Glulxe/Git.
  3. Building Rust with codegen-units=1 saved 30-45kb per VM.

I’ve also tested some changes which I’m not sure about:

  1. A manual Serde deserialiser for the Metrics struct. It would save about 14kb (down from 20kb), but it’s not completely comparable as it doesn’t have as thorough error checks; were I to decide to use it I’d probably want to add a few more. I’m not sure about it as it’s a comparatively small change, and it’s one of the few structs that a manual deserialiser might actually make sense for (as it’s very repetitive).
  2. Stopping normalising dates cuts 48kb from Glulxe/Git.

I’m not sure what the next optimisation to attempt would be. There’s a very long tail here; I think switching to RemGlk-rs has added a lot of code in large part because of the Mutexes I have to use all over the place. Each one isn’t a lot, but they all add up.

2 Likes