Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can scala compiler utilize multi-core CPU?

Tags:

Is there any benefit from compiling Scala code on multi-CPU machine?

(Asking about scala compilation, not about scala code for multi-core processing)

like image 847
orshachar Avatar asked Mar 27 '19 16:03

orshachar


People also ask

Do compilers use multiple cores?

Modern Intel compilers automatically make use of the multiple cores, with MPI even treating each core as a separate processor.

How does the Scala compiler work?

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.


1 Answers

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.)

like image 131
Mirco Dotta Avatar answered Sep 20 '22 17:09

Mirco Dotta