1

I'm a long time Borland users ( since Turbo C ) ( until BC5.2 ). I've been using MingW/GCC with CodeBlocks for about a year now, mainly for the extra support esp. native 64bit integers.

Anyway, I have a query regarding compilation speeds.

I have a C (Win32) file which is apx 60,000 lines in length. On Borland 5.2 this file takes apx 3-5 seconds to compile. On GCC it takes a bit over 35 seconds.

The GCC command line options I am using are.

-std=c99 -s -O2 (ive also tried -O)

The final exe size is pretty much the same +/- 50kB.

Why the big difference in compilation time ? and is there a way to speed up GCC to be comparable to BC5.2 ?

Johan
  • 74,508
  • 24
  • 191
  • 319
  • 6
    Come on, there has been no reason to use Borland for a decade now. It's not actually a C++ compiler. – Don Reba Sep 27 '11 at 12:27
  • 1
    `gcc -O` is the same as `gcc -O1`. To (almost) completely disable optimization use `gcc -O0`. – pmg Sep 27 '11 at 12:30
  • 1
    Does the execution time of the resulting binary differ between Borland and GCC? – Fred Foo Sep 27 '11 at 12:30
  • @Reba: apparently the OP is not interested in C++ anyways – pmg Sep 27 '11 at 12:31
  • @larsman The final exe size is pretty much the same +/- 50kB. –  Sep 27 '11 at 12:42
  • @Don , I've been using MingW/GCC with CodeBlocks for about a year now. –  Sep 27 '11 at 12:43
  • @AshodApakian: I asked about execution time, not binary size. – Fred Foo Sep 27 '11 at 12:43
  • I'm not questioning if GCC is better than Borland or vice-versa. Just would like to have an insight as to why Borland compiles the same file 10 times faster ( with the same output both for code generated and size ) –  Sep 27 '11 at 12:56
  • yes, that made very little difference (maybe a second or two). –  Sep 27 '11 at 13:57

1 Answers1

3

Borland's compilers were designed from inception to be fast, at least according to marketing and benchmarking published at the time, and widely acknowledged in the industry. They target a single architecture, the x86 family.

gcc was not designed to be fast. It is designed to:

  • target code for multiple architectures, from embedded controllers to supercomputers
  • be hosted on multiple architectures
  • keep pace with the ever changing C++ language standard

The divergence of the intended use undoubtedly affects its performance.

wallyk
  • 56,922
  • 16
  • 83
  • 148