I noticed that my gcc compiler does not work as fast as it should.
To compile a simple hello world program should only take a few seconds, but it seems to 'hang' for a while and it can be as much as 10 seconds.
What can be causing this very slow compile time?
You can not measure compiler performance with trivial programs that take only a few seconds to compile. There are way too many variables involved, caching being the most important. Compile something like editors/vim on two different systems to get a more realistic benchmark. Repeat the compilation few times and use the average time.
Perhaps I misunderstood the OP, however, IMHO this thread is not about benchmarking GCC, but whether it may take 10 s for compiling a "Hello, World!". My answer was no. In the past I used GCC over years in many versions on much slower machines than the ones used nowadays, and it never took 10 s for a simple "Hello, World".
So again, there is something horribly wrong with his machine, perhaps a defect HD.
To give this answer it is not necessary to measure whether compiling "Hello, World!" takes 0.8932 or 0.7487 seconds on a given machine.
The only time I have seen a compiler take that long to build a simple program was in a virtual machine. If I had to guess I'd assume the poster is running in a VM that is choked for resources. Or trying to run GCC on a machine that is already using 100% CPU for something else.
See also http://forums.freebsd.org/showthread.php?t=35423. Something is not right on that computer. It may not be anything to do with the compiler. The first thing to check is /etc/make.conf for the usual "optimizations". Also worth looking at BIOS settings to see if the CPU has been throttled or caches disabled. Could also be a failing hard drive, so using sysutils/smartmontools to check the drive is worthwhile: # smartctl -a ada0 | less -S
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.