Liste des Groupes | Revenir à cl c |
On 17/06/2024 07:22, James Kuyper wrote:What "tricks" ?On 6/13/24 10:43, Michael S wrote:On Thu, 13 Jun 2024 13:53:54 +0200...
David Brown <david.brown@hesbynett.no> wrote:>I know more than most C programmers about how certain C compilers>
work, and what works well with them, and what is relevant for them -
though I certainly don't claim to know everything. Obviously Bart
knows vastly more about how /his/ compiler works. He also tends to
do testing with several small and odd C compilers, which can give
interesting results even though they are of little practical
relevance for real-world C development work.
>
Since he do compilers himself, he has much better feeling [that you
or me] of what is hard and what is easy, what is small and what is big,
what is fast and what is slow. That applies to all compilers except
those that are very unusual. "Major" compiler are not unusual at all.
The problem is that Bart's compiler is VERY unusual. It's customized for
his use, and he has lots of quirks in the way he thinks compilers should
work, which are very different from those of most other programmers.InCompilation speed is important to everyone. That's why so many tricks are used to get around the lack of speed in a big compiler, or so many extra resources are thrown at the problem.
particular, compilation speed is very important to him, while execution
speed is almost completely unimportant, which is pretty much the
opposite of the way most programmers prioritize those things.
Runtime performance is important too, but at this level of language, the difference between optimised and unoptimised code is narrow. Unoptimised may be between 1x and 2x slower, typically.That depends on the language, type of code, and target platform. Typical C code on an x86_64 platform might be two or three times slower when using a poorly optimising compiler. After all, the designers of x86 cpus put a great deal of effort into making shitty code run fast. For high-performance code written with care and requiring fast results, the performance difference will be bigger. For C++, especially code that makes good use of abstractions, the difference can be very much bigger. For C code on an embedded ARM device or other microcontroller, it's not unusual to see a 5x speed improvement on optimised code.
Perhaps slower on benchmarks, or code written in C++ style that generates lots of redundances that relies on optimisation to make it fast.I virtually always have optimisation enabled during development. I might, when trying to chase down a specific bug, reduce some specific optimisations, but I have never seen the point of crippling a development tool when doing development work - it makes no sense at all.
But, during developement, you probably wouldn't use optimisation anyway.
In that case, you're still suffering slow build times with a big compiler, but you don't get any faster code at the end of it.I cannot imagine any situation where I would think that might be a good idea.
I sometimes suggest to people to use Tiny C most of the time, and run gcc from time to time for extra analysis and extra checks, and use gcc-O3 for production builds.
(I have also suggested that gcc should incorporate a -O-1 option that runs a secretly bundled of Tiny C.)
Les messages affichés proviennent d'usenet.