3 ms·
In general (not for server apps), two major benefits of Scala Native are: - Predictable latency if desired (optional GC) - Very low call overhead for C ABI
by Recurecur 10y ago
In general (not for server apps), two major benefits of Scala Native are:
- Predictable latency if desired (optional GC)
- Very low call overhead for C ABI
As to your point about memory use, Java trades memory for convenience, not performance. GC requires substantially more memory for similar performance. I read an IBM blog (which I can't find at the moment) within the last week which showed a Swift web service running slightly faster than Java, but using only half the memory.
The following comparison is also interesting, with a JSON serialization example in Swift outpacing Spring/Java by a factor of ten... This is also running on Linux instead of macOS.
https://medium.com/@qutheory/server-side-swift-vs-the-other-guys-2-speed-ca65b2f79505#.r05cqft14 https://medium.com/@qutheory/server-side-swift-vs-the-other-...
- wtetzner 10y ago> Predictable latency if desired (optional GC) Does Scala Native support not using a GC? It seems like it would be difficult to get Scala working without a GC.
- Recurecur 10y agoIt supports direct allocation via both the heap and the stack. type Vec = CStruct3[Double, Double, Double] val vec = stackalloc[Vec] // allocate c struct on stack !vec._1 = 10.0 // initialize fields !vec._2 = 20.0 !vec._3 = 30.0 length(vec) // pass by reference ...and... @extern object stdlib { def malloc(size: CSize): Ptr[Byte] = extern } val ptr = stdlib.malloc(32) http://www.scala-native.org/en/latest/ http://www.scala-native.org/en/latest/ Otherwise it currently uses the Boehm GC. One big area that needs more work: "Scala Native doesn’t yet provide libraries for parallel multi-threaded programming and assumes single-threaded execution by default."
- SureshG 10y agoThe medium post is really a stupid benchmark. Check this for a real JSON serialization benchmark - https://www.techempower.com/benchmarks/#section=data-r13&hw=ph&test=json https://www.techempower.com/benchmarks/#section=data-r13&hw=...
- usrusr 10y agoTo be fair, in that list, the spring entry didn't exactly run circles around the competition either. It's somewhere between the better PHP contenders and even behind grails (which can be pretty accurately described as spring with layer of slowness added on top). Really looks like there is something unfortunate going on with the idiomatic way to implement those examples on spring.