Is there any benefit from compiling Scala code on multi-CPU machine?
(Asking about scala compilation, not about scala code for multi-core processing)
Modern Intel compilers automatically make use of the multiple cores, with MPI even treating each core as a separate processor.
Scala has both a compiler and an interpreter which can execute Scala code. The Scala compiler compiles your Scala code into Java Byte Code which can then be executed by the scala command. The scala command is similar to the java command, in that it executes your compiled Scala code.
Triplequote Hydra is a commercial multicore Scala compiler enabling parallel compilation of Scala code. Speedups are in the order of 2x (50% faster) with a quad-core machine, and can scale up well on hardware with more cores.
Note that the Scala -Ybackend-parallelism <n>
flag only enables parallelization of the last phase of the compiler pipeline, which is the bytecode emission. Bytecode emission usually takes very little time compared to other compiler phases (e.g., typechecking), hence the gains are small or negligible depending on the code.
(Full disclosure, I'm a founder of Triplequote.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With