binary_size/

directory
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: Apache-2.0

README

Binary size workloads

These fixed programs keep LLGo binary-size measurements comparable across linker and PCLN packaging changes. The comprehensive linker/PCLN matrix is maintained by llgo-test/benchmarks; benchmark/baseline reuses the three smallest workloads for the per-commit lightweight size and timing gate.

  • cprintf: the smallest C-library hello world, using only lib/c.Printf.
  • println: a hello world using the built-in println.
  • fmtprintf: a hello world using fmt.Printf.
  • texttemplate: a heavier standard-library program using text/template.
  • nilfault: an import-free abnormal path that dereferences a nil pointer.

The first four programs must exit successfully with their expected output. nilfault must exit unsuccessfully with a nil-pointer diagnostic in every mode; for external, check it once with the sidecar present and once after the sidecar has been removed. The runtime integration suite separately verifies that a hardware-fault signal path never starts sidecar I/O.

Size reports for -pclntab=external must record the executable and its .pclntab sidecar separately, with their sum shown explicitly. Run every linker/PCLN variant at the same output path: DWARF records paths, so changing the output path can otherwise make byte counts look different even when two flag combinations have equivalent code-generation semantics.

This initial matrix applies to native Darwin/Linux executable builds; generation, archive/shared, and fixed-target policies are outside this benchmark.

Native Linux DWARF is zlib-compressed by default. Include an explicit -ldflags=-compressdwarf=false control when comparing debug-information volume, and distinguish executable size from compressed DWARF section size. Darwin DWARF measurements must include a separately generated dSYM when reporting complete debug artifacts. Size-optimized main executables restrict automatic dynamic exports independently of DWARF; this preserves debugger metadata and runtime PCLN. The default optimization level, LTO selection, and development-only Go global-DCE policy are unchanged.

The comparison matrix is the Cartesian product of embedded|external|none and these linker groups: default, -w, -s, and -s -w=false. Native Linux/Darwin -s removes ordinary symbols after PCLN finalization. Check that -s is smaller than -w, and that -s -w=false preserves usable DWARF while reducing executable symbol overhead. ELF retains dynamic symbols and debug sections when requested; Mach-O retains required dynamic-binding entries and generates a matching .dSYM before stripping. Record the complete dSYM bundle separately and include it in debug totals.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL