Hacker News new | past | comments | ask | show | jobs | submit login

I actually like Swift: advanced type system and compiler, clean syntax, very fast.

I think optionals are a great way of saying: “Hey developer, this value can sometimes be nil; be sloppy or not, your call.”

Any language you pick is an interplay of choices and compromises. No such thing as perfect.




> very fast

This is a common sentiment, but it rarely holds up to closer scrutiny (such as measurements...). Swift is both slow to run and very slow to compile. Both compile and runtime come with extremely high variance. Such unpredictability is arguably even worse than just plain slow performance.


In most of these benchmarks [1] Swift's performance comes pretty close to that of Rust. So yeah, I would call that very fast.

[1] https://web.archive.org/web/20190402100249/https://benchmark...


Try some JSON benchmarks with Codables in Swift vs serde in Rust. Rust smokes Swift, something like 20x.

Incidentally I've spent considerable effort on this problem, including writing a prototype faster JSON parser in Swift (still about 3x slower than Rust, but a huge speedup over what's there). I couldn't get anyone in the Swift community to care enough to motivate me to finish the work, which is indicative of a deeper problem: Swift just doesn't have "performance culture," the benchmark game results notwithstanding.


Hmm...when I look at those numbers, Swift only comes close in a very few, is significantly slower in most (50%-4x) and much slower in one (45x):

fannkuch / pidgins: essentially the same

binary-trees / fasta / Mandelbrot: ~ 1.5x slower

spectral-norm / reverse-complement: >= 2x slower

k-nucleotide / n-body: ~4x slower

regex-redux: 45x slower


Up until Swift 4, compilation took longer than with Objective-C according to my experience. Not sure how much Swift 5 has changed things.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: