Speeding up wasm compilation for quicker development

The default wasm optimization flag is -Oz, which is a bit slow for development. To speed up, wasm compilation, I set the optimization flag to -O1.

There’s .hcbuild, on each zome, which has the json for each build command. I created .hcbuild.prod.json which has the -Oz flag & .hcbuild.dev.json which has the -O1 flag.

I then symlink .hcbuild.dev.json -> .hcbuild for development builds & .hcbuild.prod.json -> .hcbuild for prod builds.

2 Likes

Cool, thanks for the tip. Gonna move this to the learning library so other people can find it. Also take note: this is likely to change the DNA hash, so make sure that you’re consistent with optimisation flags in the binaries that you actually distribute :wink:

1 Like