c++ - 使用-j1而不是-jN编译有什么好处

标签 c++ c gcc

使用-jN编译会编译得更快,因为它同时编译多个部分。但 GCC 文档说(虽然我找不到确切的链接)使用 -j1 编译将产生更好的优化二进制文件。

您能解释一下使用 -j1 进行编译的所有好处吗?您甚至可以提供一个小的 POC 来证明使用 -j1 进行编译会生成比 -jN 更优化(在性能方面)的二进制文件吗?

最佳答案

-j 选项用于 make。 gcc 没有这样的选项

我认为您正在谈论 -O 选项。

这是 -O1 的手册页

   -O1 Optimize.  Optimizing compilation takes somewhat more time, and a lot more memory for a large function. 
   With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time.

关于c++ - 使用-j1而不是-jN编译有什么好处,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30525172/

相关文章:

c++ - IPV6 套接字 connect() 返回 EADDRNOTAVAIL

c++ - mkdir,带符号的路径名

c++ - tbb::parallel invoke 仅执行一次函数

c++ - Windows 7/64 中的串行异步 I/O

c++ - Omnet++:作为复合模块的子模块调用时找不到类

python - 安装 pymix 时出现错误 : command 'gcc' failed with exit status 1,

c - GCC优化后如何丢弃未使用的函数

c - 错误 C2106 : '=' left operand must be l-value

c++ - 循环和if的优化

c++ - 使用 -O3 编译时的不同评估