Back to Azul

Bloaty Analysis: `libazul.dylib`

scripts/bloaty-analysis.md

0.0.75.9 KB
Original Source

Bloaty Analysis: libazul.dylib

Binary: /Users/fschutt/Development/azul/target/release/libazul.dylib Build: Release with debug symbols Total size: 27.2 MB Analysis date: 2026-02-26


Section Breakdown

Size%Section
11.6 MB42.5%__TEXT,__text (code)
7.18 MB26.4%__TEXT,__const (constants/data)
3.19 MB11.7%String Table
3.04 MB11.2%Symbol Table
1.46 MB5.3%__DATA_CONST,__const
216 KB0.8%Code Signature
212 KB0.8%Export Info
135 KB0.5%__TEXT,__cstring

Top Anonymous Constants (Largest Data Blobs)

SizeSymbolIdentified as
2.77 MB_anon.66787c…ICU segmenter dictionaries — Thai/Burmese/CJK word-break data from icu_segmenter_data
917 KB_anon.798763…encoding_rs charset lookup tables
650 KB_anon.4faf4e…Azul debug server embedded HTML/CSS/JS strings (E2E test routes)
499 KB_anon.b005ec…ICU locale blob from icu_provider_blob (root locale "und")
372 KB_anon.77f5508…874regex_automata compiled DFA tables
307 KB_anon.eed79d…Unknown (likely more encoding/regex data)
299 KB_anon.c36a09…More debug server strings ("Bad datastore lookup", etc.)
228 KB_anon.77f5508…742More regex_automata NFA tables
148 KB_ecp_nistz256_precomputedring crypto — P-256 ECDH precomputed table
119 KBbrotli_decompressor::dictionary::kBrotliDictionaryBrotli decompression dictionary

ICU total: ~3.27 MB (2.77 MB segmenter + 499 KB locale blob) regex tables total: ~600 KB Debug server embedded strings: ~950 KB


Top Named Code Symbols

SizeSymbol
67.9 KBazul::desktop::shell2::common::debug_server::process_debug_event
67.3 KBazul::desktop::shell2::macos::gl::GlFunctions::initialize
67.2 KBtaffy::compute::grid::track_sizing::resolve_intrinsic_track_sizes
56.6 KBazul_css::CssProperty::clone
52.2 KBazul_layout::widgets::text_input::TEXT_INPUT_CONTAINER_PROPS
41.0 KBwebrender::renderer::Renderer::draw_frame
36.9 KBencoding_rs::data::BIG5_LOW_BITS
23.1 KBdebug server ExportedLibraryResponse deserialize visitor

Dependency Rlib Sizes (unstripped, from target/release/deps/)

These are pre-monomorphization .rlib sizes; actual contribution to the binary is smaller.

rlibSize
libazul_layout131.4 MB
libobjc2_app_kit129.7 MB
libazul119.0 MB
libobjc2_foundation62.5 MB
libwebrender60.8 MB
libazul_core55.2 MB
libazul_css39.5 MB
libicu_datetime36.7 MB
liballsorts32.8 MB
libimage28.3 MB
libmoxcms23.4 MB
librustls21.3 MB
libicu_datetime_data20.3 MB
libicu_segmenter15.8 MB
libregex_automata15.7 MB
librust_fontconfig13.4 MB
libregex_syntax13.1 MB
libwebrender_api12.0 MB
libicu_segmenter_data11.9 MB
libpxfm9.96 MB

Optimization Opportunities

High Priority

1. ICU — ~3.3 MB

  • icu_segmenter_data (2.77 MB) + icu_provider_blob (499 KB)
  • Fix: New icu_macos feature uses NSNumberFormatter / NSDateFormatter / NSListFormatter / NSString.localizedCompare: instead of bundling ICU4X data blobs. Plural rules use a compact hardcoded CLDR lookup table. build-dll now uses "icu_macos" instead of "icu".
  • Status: Done — layout/src/icu_macos.rs + cfg-gated icu.rs

2. regex — ~600 KB

  • regex_automata DFA/NFA tables compiled for 4 trivial patterns used only in try_wlr_randr() in dll/src/desktop/display.rs
  • Fix: Replace 4 regex patterns with string parsing; remove regex dep
  • Status: Done (see PR/commit)

Medium Priority

3. WebP / moxcms / pxfm — rlib overhead

  • Dependency chain: image (webp feature) → image-webp v0.2.4moxcms v0.7.9pxfm v0.1.25
  • libmoxcms is 23.4 MB rlib, libpxfm is 9.96 MB rlib
  • Fix: Remove webp from all_img_formats or from build-dll defaults
  • Risk: WebP is a commonly expected image format; may break apps that use it
  • Status: Under investigation

4. backtrace — small

  • backtrace = { version = "0.3.66", optional = true } is enabled by build-dll and link-static
  • Not useful in release builds without debug info parsing
  • Fix: Remove from build-dll/link-static; enable only in dev profile or behind a feature flag
  • Status: Not yet done

5. Debug server (spmc, strum) — small

  • spmc provides an SPMC channel used exclusively in debug_server.rs for timer→window thread communication
  • strum used in debug_server.rs for enum iteration over DebugRequest variants (also used in azul-css so can't fully remove)
  • Fix: Gate the debug server behind an optional feature (e.g., debug-server); spmc goes away completely
  • Status: Not yet done

Low Priority / Keep

6. tfd (tiny-file-dialogs)

  • Native file open/save dialogs on all platforms
  • Deeply integrated; removing would break file dialog API
  • Decision: Keep

7. ICU (alternative) — localization/date formatting

  • icu is pulled in by azul-layout for proper Unicode segmentation, date formatting, etc.
  • Decision: Keep as opt-in feature; do NOT include in default build-dll

Summary Table

ItemActual binary impactActionStatus
ICU segmenter + locale data~3.3 MBmacOS Foundation backend (icu_macos)Done
regex tables~600 KBReplace with string opsDone
moxcms + pxfm (WebP)significant rlib overheadInvestigate removing webp from defaultsTODO
backtracesmallGate to dev-onlyTODO
spmc / debug serversmallOptional feature gateTODO