Swift Marketing and Speed
Over the past few months, the website workgroup has been redesigning Swift.org. On behalf of the website workgroup, I’m pleased to announce that we have merged the initial changes.
Our goal with the site redesign has been to make Swift.org more approachable for newcomers to Swift, highlight the language’s technical strengths, and make it easy to get started. That led to a focus on the website’s appearance, improving the user experience, and emphasizing important features such as Swift’s multiplatform support.
it’s unfortunate that the analytics script causing cmd-click to not open links in a new tab hasn’t been fixed in the redesign, something that has been an issue for at least 7 years. better luck next redesign, i guess
Swift is the powerful, flexible, multiplatform programming language.
Fast. Expressive. Safe.
[…]
Swift is the only language that scales from embedded devices and kernels to apps and cloud infrastructure.
I’ve been using Swift and contributing to Swift Evolution for a decade, it is by far my favorite and most used programming language, and I am a huge fan.
Nonetheless, when I read those lines, my immediate reaction is “Wait, the, and the only? Are they saying that no other language does those things?”
Even if true, statements like that make me question the reliability of the narrator, and they come across as somewhat disparaging of other languages rather than just building up this one.
Overall, I like the new homepage, but some of the wording is a bit much, and I think it’s unnecessary. There’s no need to pretend it’s something it’s not. I felt the same way about some of the benchmarks used to tout Swift’s performance when it was first introduced.
Swift
String
parsing is embarrassingly slow. I just converted code fromString
indices
/SubStrings
toData
indices
/SubSequences
(assuming UTF8, meh) and performance was 100x faster. Went from 8 minutes to parse an 80 MB file to 5 seconds.(Also 5 seconds is stupidly slow. Even Python can parse the same file, with the same algorithm, in about 1 second.)
My experience is that Swift can be very fast. But, especially with strings and bridging, you have to be careful and measure because sometimes there are unexpected sources of slowness. Likewise, code using Data
can really fly, but it can also get incredibly bogged down in safety checks if you don’t annotate your code such that Swift can statically prove exclusive access.
There were some important new String
optimizations announced at WWDC.
Bridging non-ASCII
NSMutableStrings
from ObjC will be slower at the point of bridging, but theString
produced as a result will be much faster.One particular case this tradeoff can end up not paying off in is if you then bridge the resulting
String
back to ObjC. If you’re in that situation the recommendation is to not double-bridge strings if you can avoid it.
Previously: