Benchmarks For gcc-3.1 37
Isle writes: "Another good story found via OSNews.
Scott Robert Ladd has updated his
GCC vs Intel C++ compiler benchmark. Now you can find gcc 3.1 benchmarked against gcc 3.0.4 and icc 6.0.
The summary must be that gcc 3.1 is a lot faster than gcc 3.0.4 for very abstract C++ code, but icc is still slightly faster overall."
Speed of compilation (Score:1)
Rik
Re:Speed of compilation (Score:2, Informative)
Re:Speed of compilation (Score:2, Informative)
Actually you can make yourself a faster compiler, by build gcc with icc. (libstdc++ and other compiler libraries are always build using the newly build compiler, so no speedup there)
Re:Speed of compilation (Score:3, Insightful)
I personally just write the code down, compile, run with debugger. I note worst mistakes, write them down, correct values in memory and continue test run until it've gone as far as it can without modifying code.
After this all is done, I correct code with my notes, and begin it all over again.
With this use, actual compiling is not slow if it takes 3-5 mins.
yeah, daily recompile load is about 700k C++ code + 200k headers (+100k vendors).
Some time ago I had to recompile with P133, and it took (with watcom 11.0c) approx 7min, which _felt_ like a lot. at the same time I was able to modify code in emacs, so that wasn't such a bad deal until we had a really fast call.
Re:Speed of compilation (Score:2, Insightful)
Also, thanks to the complexity of C++, there is no refactoring browser (that I know of) so if I change a method signature, I have to use the compiler to tell me what needs 'fixing'.
Of course, vim is able to jump to warnings/errors generated by gcc, which helps quite a bit.
I'm currently working on about 50k lines of C++ code, where a rebuild can take anywhere from 3.5s for one file (no problem) to 90s for a change that affects more code. I'm currently using gcc 2.95.3. gcc 3.1 is much slower.
I'm using make -j 2 on a dual athlon, and I forward declare where possible to save time.
I would just prefer the focus of gcc development to shift from execute speed to compile speed. But the gcc people are free to do what they wish, it's not like I'm paying them
Rik
Re:Speed of compilation (Score:1)
Re:Speed of compilation (Score:1)
Seriously though, code is usually run a lot more than it's built, so trading speed when building for speed when running makes sense. If you want build speed, disable optimization etc.
Re:Speed of compilation (Score:1)
Duh, thanks for the tip.
Rik
-O0 is not always a good idea (Score:1)
If you want build speed, disable optimization etc.
I understand this when developing on a workstation [dell.com] for a workstation [gateway.com] target, but if you're developing a graphics engine that must run within 200,000 machine cycles on fixed hardware [gbadev.org], and your engine already runs at 84% CPU usage at -O3, you can't afford to turn off the optimizer.
Re:Speed of compilation (Score:3, Informative)
But gcc 3.1 optimises more heavily. gcc 3.1 with -O1 compiles almost as fast as older releases with -O2, and the optimisation levels are comparable (that is, -O2 on gcc 3.1 should compare with -O1 on an earlier release)
Re:Speed of compilation (Score:3, Interesting)
Re:Speed of compilation (Score:1)
For example, how do I write an assertion that downloading some data didn't make the UI stall for long enough to be noticeable ? Or that the formatted text I presented to the user has the right colours and line wrapping to make it pleasing to the eye ? Or that the correct icons were loaded for the toolbar buttons ?
This is not about programming paradigms, it's about the reality of testing large apps.
Rik
Re:Speed of compilation (Score:3, Informative)
Having said that, I think the examples you gave are more amenable to runtime checking than you might think. Checking time constraints is trivial--all you need is a couple calls to gettimeofday--though the challenge here would be to find a systematic way to put these checks in all the right places. A more fundamental challenge is to reason about the delay that might occur during various operations, in order to convince yourself that you will indeed satisfy the assertions. However, none of this is impossible, as you seem to imply. For instance, using timeouts can help you put an upper bound on the delay of I/O operations.
GUI assertions are different, though these are still possible. The key is that you should Design by Contract, just as the hardware folks design for testability. In other words, don't simply code the way you already do, and just throw in a few assertions; rather, you change the way you code in order to make it amenable to assertions to the greatest possible extent.
In the case of a GUI, the idea is to leave everything in data structures as late as possible, and then make the actual rendering stage trivial. Then, right up to the renderer, you can assert that the text has a certain colour. The rendering stage itself may not be amenable to assertions, but the idea is to keep that as small, as simple, and as widely-used as possible.
Assertions don't replace testing; rather, Design by Contract multiplies the tests' effectiveness.
Re:Speed of compilation (Score:1)
You also can't just 'assert that the text has a certain colour' in complex rendering code. I'm not just talking about displaying one word in a certain colour, I'm talking about a massive amount of text, which is formatted and marked up before display. Whether it is done 'correctly' or not is extremely difficult to write checking code for. It's far better to simply have a look and see.
Anyway, these were two examples of 'untestable' problems that one faces when writing complex apps. There are many more, and yes, they may in fact be testable, but it would take 10 times longer to write the app if you wrote (hideously complex) tests for such things. Time is money, projects have deadlines, etc.
Rik
Re:Speed of compilation (Score:1)
What I argue with is your assertion (no pun intended) that such parts are of a "higher level" than those parts which are testable. I contend that they are merely of a different "kind". GUIs are full of this kind of thing. I grant that GUIs are hard to analyze with DbC, but I claim that mony other parts of a program benefit tremendously from this kind of analysis.
Your example of perceived latency is a perfect example of this, since real-time programmers do this kind of analysis for exactly this reason.
Re:Speed of compilation (Score:5, Interesting)
Re:Speed of compilation (Score:3, Insightful)
Absolutely. Anybody who uses a single compiler on an important project (at least during the development stage) is just begging for problems later on down the road.
Re:Speed of compilation (Score:1)
Re:Speed of compilation (Score:3, Informative)
gcc's compilation speed can certainly be a problem for very large projects or even smaller projects on slower machines. Unfortunately, things have actually been getting worse for newer releases. Part of this is due to additional optimizations, but there are some genuine performance problems that the gcc developers would very much like to solve.
Now that this has become a major priority, I expect things to start improving in the not too distant future.
Interesting article, and a suggestion... (Score:3, Interesting)
Maybe gcc is slow because of glibc? (Score:3, Interesting)
Paul.
Re:Maybe gcc is slow because of glibc? (Score:1, Informative)
Why don't you check the glibc drand48 source code. Not that it would matter - icc doesn't include a libc, so the same glibc function is being used by both.
Re:Maybe gcc is slow because of glibc? (Score:1)
Re:Maybe gcc is slow because of glibc? (Score:1, Informative)
What about 2.9x? (Score:3, Insightful)
Re:What about 2.9x? (Score:3, Informative)
It's not true that 2.9x is the only compiler that compiles the kernel. gcc 3.0 and 3.1 also can, indeed kernel compilation was part of the release criteria (maybe you're mixing it up with "2.96" ?) Comparisons would be nice, but FYI, 2.95 is not going to be any faster than gcc 3.0. (and probably slower)
Why only benchmark fringe compilers, when a vast majority of Linux users will be rocking the older compiler?
gcc 3.1 is not a fringe compiler. You are going to see it in the next Redhat release (as well as the distributions that follow Redhat)
Re:2.96 was in Red Hat (Score:2)
I wouldn't call it a fringe compiler, the only sense in which it's "fringe" is that it's only used on Linux. That said, gcc 3.1 is likely to be widely used and deployed, because it really is a lot better than gcc 2.9x, and because it addresses the primary obstruction to gcc 3.0 becoming a mainstream compiler -- bugs. In fact, I suspect that even gcc 3.0 is used by a number of developers for testing purposes. I have used it to test ISO compliance and "std::-cleanliness" of my code.
Red Hat is not linux.
That may be so, but it's also true that Redhat and Redhat based distributions make up a substantial portion of Linux users.
It does compile the linux kernel (Score:1)