有没有办法提高Java编译器的多核/多处理器性能?

时间:2022-02-12 03:59:31

My coworker noticed that when javac is compiling it only utilizes a single core. Is there anything like the -j command with the gcc for Java that will allow us to distribute the compiler workload across cores or processors? If not, do you think that this will ever be possible or is there some sort of fundamental restriction as a result of Java's design?

我的同事注意到,当javac正在编译时,它只使用一个核心。是否有类似-j命令与Java的gcc,这将允许我们跨核心或处理器分配编译器工作负载?如果没有,您是否认为这将是可能的,或者由于Java的设计是否存在某种基本限制?

The environment is Linux with the Sun J2SE 1.6.0.11 jdk.

环境是使用Sun J2SE 1.6.0.11 jdk的Linux。

1 个解决方案

#1


5  

Although not exactly an answer to your question, some build environments like ant also support parallelization of builds, so if your dependency graph permits you can have multiple javac's running at the same time.

虽然不完全是你的问题的答案,但像ant这样的构建环境也支持构建的并行化,所以如果你的依赖图允许你可以同时运行多个javac。

#1


5  

Although not exactly an answer to your question, some build environments like ant also support parallelization of builds, so if your dependency graph permits you can have multiple javac's running at the same time.

虽然不完全是你的问题的答案,但像ant这样的构建环境也支持构建的并行化,所以如果你的依赖图允许你可以同时运行多个javac。