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

Anyone know how Swift performance compared to Scala? Those are pretty similar, I've heard. I'm pretty familiar with Scala, but not Swift. Is there any reason to switch to Swift?



The main thing to know about Swift performance is that it varies hugely depending on what you're trying to do. I think it will take some time for the implementation to mature to a point where it becomes less hit and miss performance-wise. Swift as a language has all it takes to create a consistently fast implementation.

The wildcard is probably the decision to go with reference counting over a tracing GC. We'll see how that works out. There are good arguments on either side.


They aren't so similar. Feature-wise, Swift is much closer to Kotlin, which is (on purpose) significantly simpler than Scala.

Also if you're using Scala, there's a huge ecosystem of libraries and frameworks that just doesn't exist in Swift. If you want native compilation, just wait for http://www.scala-native.org/


That will rely on LLVM?


I haven't seen any data. Scala has been around for a while, which means more time to spend on optimization, so it's probably faster at this point. Because of garbage collection on JVM, Swift has the potential to be more performant though.

Unless you are trying to build some really high performance shit, what really matters is developer productivity, which is abysmal for server-side Swift right now. Getting better every day though.

Source: built and deployed a service in Swift


I know you did not mean to say that scala code is non-performent. Well written jvm is highly performant and with GC algos like concurrent mark and sweep or garbage first and a good allocation of eden, tenured (etc) space you should really never have a stop the world because of GC'ing anymore.


While it's true you should never stop the world for CMS in a server-side program where you can control memory tuning, newgen collection is still stop-the-world, and can cause multi-millisecond pauses on ~8GB heaps.


> Swift performance compared to Scala?

Depends how you write the code :-)

http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: