Monday, December 12, 2016

The Opportunity of Swift on the Server

Stephan Knitelius (via Chris Lattner):

Java and other languages that compile to Java byte code run on the JVM. In a world of Docker containers the JVM is just yet another layer eating up resources. The claim “write once run any where” is just as true for a Swift applications packaged into a Docker container as for a Java Application running on top of a JVM.

Running an application in JVM, that is running in a Docker container, that is running on a virtual host seems rather ludicrous. Swift compiling to native machine code, has the advantage of a rather small memory footprint. When running hundreds or thousands of instances, as many tech companies do, even saving a couple of MB on memory footprint generates real business incentive.


Also garbage collection comes at a high cost. Employing concurrent mark and sweep algorithms, it still requires more memory and CPU cycles then immediately assigning and releasing memory as needed.

2 Comments RSS · Twitter

"Swift has been around since 2014 and has become the primary language for IOS and OS X development"

OS X development? In which alternate reality?

Looking at the benchmark used in the article, it's interesting to see that Go — a garbage-collected language — is slightly better than Swift on performance and memory usage. Certainly the JVM is a staple in the server space, but for Swift fans to make headway on servers, I think they'll have to present themselves as a better alternative to Go instead of the JVM.

Leave a Comment