Skip to content

Measure and reduce code size of core icu_capi functionality #4700

Open
@sffc

Description

@sffc

Currently the core cdylib for icu_capi is about 100 kB when generated with this command:

cargo +nightly rustc --crate-type cdylib --profile=release-opt-size --no-default-features --features looping_panic_handler,libc_alloc,buffer_provider  -p icu_capi -Zbuild-std=core,alloc -Zbuild-std-features=panic_immediate_abort --target=x86_64-apple-darwin

(on Mac, also pass RUSTFLAGS=-Clink-args=-Wl,-undefined,dynamic_lookup,-lSystem)

Looking at the cdylib, the biggest contributors to code size are

  • ICU4XDataProvider_enable_locale_fallback
  • icu_locid::extensions::Extensions::try_from_iter
  • icu_provider_adapters..fallback..LocaleFallbackProvider
  • ICU4XLocale_canonicalize
  • ICU4XLocale_total_cmp
  • icu_provider_blob..blob_data_provider..BlobDataProvider

Ideally we should get this core logic to be below 50k or less. There may be some low-hanging fruit.

We should add a CI job similar to the tiny jobs.

CC @robertbastian @mosuem

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ffiArea: FFI, WebAssembly, TranspilationC-ffi-infraComponent: Diplomat, horizontal FFIS-mediumSize: Less than a week (larger bug fix or enhancement)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions