Gleam Build Profiles: Transitioning from Dev to Prod for Erlang Targets
0 reputation · 06 Sept 2022, 18:59 UTC
Build Profile Configuration
Gleam 1.0+ utilizes dev and prod build profiles within the gleam.toml configuration. The dev profile is designed to preserve debug information and disable specific optimizations to facilitate local development and debugging.
Production Optimization Constraints
When switching to the prod profile, the compiler enables BEAM optimizations and strips metadata. While this improves performance, it alters the resulting bytecode and stack trace characteristics. There is a known risk that certain optimization flags may change tail-call optimization behavior, which could potentially impact the stability of recursive functions that were stack-safe during local development.
Verification Requirements
To ensure parity, it is necessary to verify that recursive logic remains stable under production-level optimization and that the absence of debug info does not hinder critical production telemetry.
- Does the
prodprofile introduce specific BEAM optimization flags that can alter tail-call behavior compared todev? - What is the recommended method for verifying stack safety in production builds without relying on
devdebug metadata?