Swift at Apple: Migrating the TrueType Hinting Interpreter
46 points by mjn
46 points by mjn
I really wish Swift would get more traction on non-Apple platforms. I really like it as a language, more so than Rust, but Rust definitely populated all of the niches it could occupy on non-Apple stuff.
I really like Swift, but Rust made friends with developers. Apple isn't very good at that
[edit: <swearing> I don’t know why every comment I write turns into a gigantic wall of text]
The swift folk have been really working on supporting non-Apple platform developers, but I suspect it will never truly escape the “language for Apple software” label.
It also incurs costs not present in rust, first group, object lifetime management:
These are really nice features from an ease of use PoV, but the cost can be significant (refcounting and CoW tests get slow when subject to multithreaded contention).
The other source of accidental overhead is the strict design goal of ABI stability. This is an extremely important feature, but the costs go from relatively minor (offsets into fields across package/library boundaries become indirect - non-fragile types), to high: generic interfaces default to a stable abi, which in a practical sense lowers to something approximately equivalent to rust’s dyn trait. If your library does not have ABI constraints it can be somewhat irksome to find and fix cases where the codegen is unnecessarily pessimistic for the purpose of abi stability.
Now those costs would rule swift out of the embedded space, but to deal with that there is embedded swift which essentially means that the super dynamic or runtime heavy behaviours become unavailable but beyond that high level hand waving I don’t know specifics.
Now for personal gripes:
I also dislike the kinds of applications that come from SwiftUI but that’s not really a language issue, and I don’t write ui code either, e.g. it’s “only” an issue from the user end, not from a developer PoV.
TLDR: While there are a bunch of features in swift that I really like, there are also a bunch of trade offs that make it often slower than Rust programs (see this article for examples where they needed to not use the default style of swift code in order to reach the target perf).
The “killer” feature is ABI stability even at the high level language constructs, but that’s only just started to be something (I think) rust is trying to address, but it requires a willingness to have the kind of indirection (at least, if not implicit allocation) that is counter to the rust design pronciples.
I'm sure Swift is nice enough, but it's incredibly clear where their focus is. Why be a second class citizen in Apple's world, when I could use languages which focus their attention on platforms I care about?
Same reason I don't use C# to be honest, it seems like a good language made by smart people but it has such a long history of not giving a shit about non-Windows platforms outside of community projects like Mono that I don't see why I'd want to use it, there are other alternatives
Swift is my daily driver now, but it does still have issues with binary size on non-Apple platforms, where the Foundation framework isn’t built into the OS. (Exacerbated by problems dead-stripping unused symbols.)
How does that compare to other languages where you statically link its runtime and stdlib (say, go, rust)? Is Swift stdlib really that heavy? Or is it just in comparison to Apple platforms where you link dynamically?
I’m not sure actually. I know Go is pretty heavyweight because of the runtime for the GC and all that. My preconception is Rust is lighter-weight. People on the Swift forums describe 50MB+ overhead in binaries that link Foundation
Much of the problem is that Foundation embeds ICU for Unicode support and libcurl for networking, both of which are pretty chonky.
Mostly I worry about this for Android, because people do still care about app sizes on mobile platforms. Desktops are a lost cause, viz. Electron.