Building for ProductionEdit on GitHub
When you’re satisfied with your program and ready to create a production build, the Grain CLI provides a few tools to help you create small, efficient WebAssembly binaries.
Compiling with the
release profile turns on a number of additional optimizations that make the resulting Wasm file significantly smaller and faster than the development builds, at the cost of a bit more compilation time. The
release profile can be enabled via the
Since Grain programs are fully typechecked at compile time, runtime type information is only necessary for the generic
toString functions, typically used for debugging. If your programs do not rely on
toString for enum variants or records, you can drop all runtime type information from the module to get them a bit smaller:
Without runtime type information,
<enum value> and
<record value> respectively. If this constraint is acceptable, you can take advantage of this flag and reduce your module sizes by a few kilobytes.