Trame

What a build holds

A program's executable holds the toolkit's code that the program reaches, and nothing else: the Formula compiler emits no procedure that nothing calls. Some parts are reached by every program, through calls that stay in a release build or data that a widget loads; each of these is behind a define, and a program's tool chooses them once in toolbox.Project.features (toolbox.md, "Features").

What the compiler leaves out by itself

Measured on Linux, release build (--release):

  • A procedure that nothing reaches is not in the executable. An import whose package nothing uses costs 0 bytes and no measurable compile time (the type check of the whole toolkit takes about 0.1 s).
  • A foreign import none of whose procedures is reached is not given to the linker: the library is not linked.
  • Data loaded with #load that nothing reads is not in the executable.
  • Kept whatever is reached: an @(init) procedure of any package that is imported (the toolkit has none), and what @(require) names.

Splitting a package in two (syntax out of ui, notifications out of platform) therefore makes no executable smaller.

The parts behind a define

Sizes measured on Linux, -o:speed, 2026-11-13. Each row adds its option to the row above it. "Stripped" is the executable after strip, as release.package_ ships it on Linux.

examples/whatsnewExecutableStripped
Before (the endpoint in every build)29,059,99221,550,336
Release default: no devtools endpoint (TRAME_DEVTOOLS false)28,708,200 (−351,792)21,211,728 (−338,608)
LUCIDE_SUBSET: 25 icons, 10 KB instead of 917 KB27,802,984 (−905,216)20,306,512 (−905,216)
FONT_EMBED_FALLBACK=false27,557,224 (−245,760)20,060,752 (−245,760)
examples/fidgetExecutableStripped
Before (the endpoint in every build)29,431,32021,914,128
Release default: no devtools endpoint29,098,752 (−332,568)21,593,056 (−321,072)
LUCIDE_SUBSET (the same 25 icons: fidget names none itself)28,193,536 (−905,216)20,687,840 (−905,216)
FONT_EMBED_FALLBACK=false27,947,776 (−245,760)20,442,080 (−245,760)

The three options together: about 1.5 MB less. Stripping: about 7.5 MB less. Without the endpoint, a release build of whatsnew takes 20.4 s instead of 23.5 s, fidget 23.9 s instead of 26.9 s (one build each).

DefineDefaultWhat it leaves outWho needs it
TRAME_DEVTOOLS#config(DEBUG, false) || #config(TEST, false)the CDP server of devtools.start_from_env (devtools.md)a tool that drives a release build over CDP: Feature.Devtools; trame build gives it to the examples
TRAME_DEBUG_WINDOWtruethe debug window, its View tab, the curve editor and the program's panels (about 1.6 MB; debug.md)every program by default; =false leaves them out
LUCIDE_SUBSET"": the whole fontthe Lucide icons the sources do not name (lucide.md)every program: Feature.Lucide_Subset
FONT_EMBED_FALLBACKtrueRoboto (159 KB) and Paper Mono (124 KB), font.FALLBACK_UI_DATA and font.FALLBACK_MONO_DATAa program that loads its fonts itself: Feature.No_Fallback_Fonts. Not one that opens its windows with host.host_open on Linux, where Roboto is the interface font
FONT_BACKENDdwrite on Windows, native elsewherethe native text library on Windows(font-backend.md)

What is not done

  • One Rust standard library with a program's own. The native text backend, Mermaid, AccessKit and libwebp are one static library (native/trame, a cargo feature each: trame build_native -features:text,mermaid,a11y,webp), with one copy of Rust's standard library. A program's own Rust library brings another: on Linux the programs link with --allow-multiple-definition (toolbox.LINUX_LINK_FLAG). Each part stays a crate (native/text, native/mermaid, native/a11y, native/webp): a program with a Rust library of its own builds the one it needs into it (FONT_NATIVE_LINK=false...).

Edit this page on GitHub