| I don’t know many good resources to learn this stuff unfortunately. The things I reach for in practice are godbolt and cargo asm[1] - which can show me the actual generated assembler for functions in my codebase. And twiggy[2], which can tell you which functions are the biggest in your compiled binary and point out where monomorphization is expensive. When I’m developing, I regularly run a script which compiles my code to wasm and tells me how the wasm file size has changed since the last time I compiled it. Some tips: Try to avoid array lookups with an index when you can. When looping, use slice iterators and when making custom iterators, wrap the slice iterator rather than storing a usize index yourself. Be careful of monomorphization. If you’re optimising for size, it can be better to take a dyn Trait rather than making a function generic. And play around with your wasm API surface area. It takes a lot more code to pass complex objects & strings back and forth to javascript than other types. But otherwise, good luck! Love the project. [1] https://github.com/gnzlbg/cargo-asm [2] https://github.com/rustwasm/twiggy |