What's in the 34 MB of ICU data in lib_FoundationICU.so, and what can be removed

@xwu Thanks for reading through it and for the honest take.

Fair point on (2). Saving 5 MB out of 63 doesn’t justify a second configuration to maintain. I’ll drop it and send a PR for the safe filter only.

Moving formatting into Swift looks like the better path: the data can be limited per locale, as the --locale option in swiftlang/swift-foundation#1991 and swiftlang/swift-foundation#2330 already allows. Where I can help there: run the Swift implementations against ICU on Linux and Android with the flags on, across all locales, and report differences, and measure what each step saves in an Android APK.

One thing I couldn’t find an answer to: what’s the long-term picture for swift-foundation-icu? In the earlier thread, Charles described building the ICU data as part of the SwiftPM build, so apps could thin it down to the locales they ship. With formatting moving into Swift, is that still the plan, or is the direction for ICU to become optional, needed only for things like collation or transliteration?

I’m asking because corelibs calls ICU directly (string encodings, CFStringTransform, NSRegularExpression), so on Android import Foundation will keep pulling in lib_FoundationICU.so even after swift-foundation stops needing it.

1 Like