[swift-dev] Reducing the size of Swift binaries by shortening symbols
clattner at apple.com
Mon Dec 21 17:58:56 CST 2015
> On Dec 20, 2015, at 9:53 PM, Dmitri Gribenko via swift-dev <swift-dev at swift.org> wrote:
>> nm -a libswiftCore.dylib > strings.txt
>> I also have a concern about making mangled names completely unreadable.
>> Today, I can frequently at least get a gist of what the referenced entity is
>> without a demangler. What we could do is make the name consist of a
>> human-readable prefix that encodes just the base name and a compressed
>> suffix that encodes the rest of the information.
>> _T<length><class name><length><method name><compressed suffix>
>> When are you looking at symbols directly? SIL already shows the detangled
>> names as comments, and for everything else there is a demangler.
> System tools to inspect object files on Linux don't know about Swift
> mangling. Yes, I can pass their output through a demangler, sometimes
> (when they don't have a GUI for example).
I see what you’re saying, but I don’t think that it would make sense to consider this. Given a tradeoff between size for all clients and users of the swift language vs compiler/library hackers having to run the demangler manually now and then, the benefit of reducing symbol sizes greatly outweigh any pain incurred.
More information about the swift-dev