swift icon indicating copy to clipboard operation
swift copied to clipboard

Allow removing Unicode tables from produced binaries

Open MaxDesiatov opened this issue 4 years ago • 4 comments

This should reduce our binary size and partially resolve #7

MaxDesiatov avatar Jan 03 '21 12:01 MaxDesiatov

From WWDC 2022 "What's new in Swift" at 5:04: "To make the standard library smaller for standalone, statically linked binaries, we dropped the dependency on an external Unicode support library, replacing it with a faster native implementation."

Is that going to help resolve this issue?

n8gray avatar Jun 09 '22 17:06 n8gray

Formally, ICU dependency is removed from the standard library, but in terms of binary size this makes things even worse for people linking with Foundation, because the latter still depends on ICU. In this case binaries have two versions of Unicode tables embedded in them: new ICU replacement in stdlib, and ICU itself from Foundation.

When not linking with Foundation, I don't think you'll see a substantial difference. The Unicode tables are still there, they're just coming from a different source.

I'll rename the issue to mention Unicode tables explicitly to avoid the confusion. In that sense the issue is still not resolved.

MaxDesiatov avatar Jun 09 '22 17:06 MaxDesiatov

Oh good lord. I was so excited! :cry: It would be nice if there was a way to delegate that to the platform somehow. Seems like wasm as a concept takes a hit if every module that needs to deal with unicode correctly has to ship its own tables.

n8gray avatar Jun 13 '22 18:06 n8gray

Yeah, if there was a nice way to customize the source of Unicode tables, we could rely on Intl.Segmenter API in the browser. At least that's what Swift String API is using Unicode tables for.

MaxDesiatov avatar Jun 13 '22 18:06 MaxDesiatov