“With the increased limit of the acceptance queue, and a patched version of wrk, we can now conclude that swift is a good competitor speed-wise as a web application server.

Memory wise it blows all the other technologies away, using only 2.5% of the amount of memory that the java implementation needs, and 10% of node-js.”

https://tech.phlux.us/Juice-Sucking-Servers-Part-Trois/

#swift #swiftlang

Juice Sucking Servers, part trois

Some technical stuff I do.

Phluxus Tech Blog
@finestructure I’m not sure it’s actually truly fair to compare to Java memory usage. But still, this is good stuff!
@mattiem I think it is in this case, because the idea is - what size VM do I need to run this workload and that’ll have a massive cost impact.
@finestructure Don’t get me wrong - Java VM tuning is an enormous pain point. You basically cannot run JVM stuff without becoming an expert. But there *is* some optimized setting and that could, conceivably compete quite well with Swift’s memory usage when handling a similar load. So think this could be hard to compare. But it’s still great and I vastly prefer it!
@finestructure You know thinking about this more, I could be wrong. I guess the fixed VM cost is represented here in this workload already. So, I take it back this rocks.
@mattiem @finestructure RC is conceptually better here *if* the RC is implemented properly, i.e. the code produces no retain cycles. Memory is freed when it isn't needed which is particularly important if you have high scale (which 98% of devs don't have, fwiw).
I've once heard that there've been high speed trading systems that could trade favourably by predicting the GC cycles of the Java systems of large banks.

@helge @mattiem @finestructure Swift doesn’t use RC though, it uses ARC.

Obj-C upgraded from an RC language to one where you could use RC or ARC or GC at and it was no contest - ARC works so much better that vigorous discussions on memory management were short lived, everyone quickly recognised ARC is faster, uses less memory, and has no drawbacks.

The Swift version of ARC is an order of magnitude better again - because the language and core libraries were carefully architected around ARC.

@helge @mattiem @finestructure the biggest win for ARC over GC and RC wasn’t memory usage. It was better at that too - but the huge win was performance.

Back when I compared all three, I found ARC was faster - a lot faster - than RC. GC was fast too but it just kicked the can down the road - once your task was finished GC would run the CPU would be saturated for a time.

These were simple/common tasks - like reading a large document. Or converting between JSON and the internal memory structure.