Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hints for shrinking cart size for Rust projects

A topic by sporksmith created Jan 16, 2022 Views: 210
Viewing posts 1 to 1
(1 edit) (+2)

It's unfortunately very easy to exceed the 64 KB cart size limit in Rust without some extra steps. I explored some different techniques here for reducing the size of the example snake tutorial. I got it down from 140 KB to 7 KB using a few different techniques, but just using `wasm-opt -Oz --strip-producers --dce --zero-filled-memory --strip-debug` is enough to get it down to ~22 KB.

Some folks are working on incorporating `wasm-opt` into wasm4's rust project template, as it already is for the others, but for now you need to invoke it manually (or write a wrapper script like this one).