我什么时候应该使用GCC的管道选项? [英] When should I use GCC's -pipe option?

查看:241
本文介绍了我什么时候应该使用GCC的管道选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GCC 4.1.2文档 -pipe 选项有这个说法:


- 管道



在编译的各个阶段之间使用管道而不是临时文件进行通信。这在汇编程序无法从管道读取的某些系统上无法工作;但是GNU汇编器没有任何问题。


我假设我能从错误消息中看出我的系统的汇编程序是不是' t支持管道,所以除了这个问题之外,我使用这个选项的时候什么时候关系?决定使用它的因素是什么?

解决方案

它通常不会产生任何影响



它有 + - 注意事项。历史上,同时运行编译器和汇编程序会压缩RAM资源。



根据今天的标准,Gcc很小, -pipe 增加了一些多核可访问的并行执行。

但是,同样的道理,CPU速度如此之快,以至于它可以创建临时文件,甚至无需读取注意到。由于 -pipe 从来不是默认模式,它偶尔会稍微起作用。一个开发人员通常会报告没有注意到时差。



现在,有一些大型项目在那里。你可以查看一个能够构建所有Firefox或NetBSD的单一树,这是非常重要的。包含所有X的东西,例如,作为次要子系统组件。当工作涉及成千上万个C文件中的数百万行代码时,您可能会注意到差异,也可能不会注意到差异。正如我确信你知道的那样,人们通常只会在这样的事情的一小部分上工作。但是,如果您是发布工程师或正在构建服务器,或者在 stdio.h,< /你可能想建立整个系统来查看你是否破坏了任何东西。而现在,每一滴的表现可能都很重要......

The GCC 4.1.2 documentation has this to say about the -pipe option:

-pipe

Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble.

I assume I'd be able to tell from error message if my systems' assemblers didn't support pipes, so besides that issue, when does it matter whether I use that option? What factors should go into deciding to use it?

解决方案

It doesn't usually make any difference

It has + and - considerations. Historically, running the compiler and assembler simultaneously would stress RAM resources.

Gcc is small by today's standards and -pipe adds a bit of multi-core accessible parallel execution.

But by the same token the CPU is so fast that it can create that temporary file and read it back without you even noticing. And since -pipe was never the default mode, it occasionally acts up a little. A single developer will generally report not noticing the time difference.

Now, there are some large projects out there. You can check out a single tree that will build all of Firefox, or NetBSD, or something like that, something that is really big. Something that includes all of X, say, as a minor subsystem component. You may or may not notice a difference when the job involves millions of lines of code in thousands and thousands of C files. As I'm sure you know, people normally work on only a small part of something like this at one time. But if you are a release engineer or working on a build server, or changing something in stdio.h, you may well want to build the whole system to see if you broke anything. And now, every drop of performance probably counts...

这篇关于我什么时候应该使用GCC的管道选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆