All major build tools support Scala Native. sbt
is most feature-rich. The simplest one is scala-cli
.
Create a file hello.scala
with single main function.
Build it in three variants: native, JVM, GraalVM. Compare binary sizes. Explain what the difference is between those runtimes.
Run the app. Measure CPU time and peak memory consumption.
Execution time | Memory | Binary size | |
---|---|---|---|
Native | ~0 | 2.3 | 1.2 |
GraalVM | ~0 | 6.5 | 12 |
JVM | 0,14 | 48 | 6.9 (jar) + JVM |