Author Topic: What is the fastest C/C++ compiler  (Read 13574 times)

daydreamer

  • Member
  • *****
  • Posts: 2395
  • my kind of REAL10 Blonde
Re: What is the fastest C/C++ compiler
« Reply #15 on: March 18, 2019, 12:26:44 AM »
why havent you included the popular tinyc in the test?It seems its the most popular C here because it produces tiny .exes
my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

TimoVJL

  • Member
  • *****
  • Posts: 1317
Re: What is the fastest C/C++ compiler
« Reply #16 on: March 18, 2019, 12:33:36 AM »
How this gcc 7 version works in intel?

EDIT TinyC
Code: [Select]
AMD Athlon(tm) II X2 220 Processor
C compiler: gcc 7.0 patchlevel 0
Elapsed time: 23925.563880 miliseconds

CLang
AMD Athlon(tm) II X2 220 Processor
C compiler: Microsoft Visual C/C++ Version: 1600 Toolset: 160040219
Elapsed time: 31937.335960 miliseconds

AMD Athlon(tm) II X2 220 Processor
C compiler: Microsoft Visual C/C++ Version: 1916 Toolset: 191627027
Elapsed time: 37098.426560 miliseconds

AMD Athlon(tm) II X2 220 Processor
C compiler: Pelles, Version 900
Elapsed time: 39354.421960 miliseconds

C compiler: TinyC x64
Elapsed time: 72122.514480 miliseconds

C compiler: tiny C 0.9.27
Elapsed time: 77501.994200 miliseconds
May the source be with you

aw27

  • Guest
Re: What is the fastest C/C++ compiler
« Reply #17 on: March 18, 2019, 01:03:37 AM »
why havent you included the popular tinyc in the test?
I have never used it and a bunch of others.  :redface:

How this gcc 7 version works in intel?
Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
C compiler: gcc 7.0 patchlevel 0
Elapsed time: 8680.080000 miliseconds

felipe

  • Member
  • *****
  • Posts: 1381
Re: What is the fastest C/C++ compiler
« Reply #18 on: March 18, 2019, 01:22:36 AM »
that's weird...i was told (by reading an article or book, don't remember exactly) that intel's compiler was the best doing the optimization phase. are you using their pay-for-it compiler? or some kind of free trial?  :idea:

anta40

  • Member
  • ***
  • Posts: 315
Re: What is the fastest C/C++ compiler
« Reply #19 on: March 18, 2019, 02:18:19 AM »
Intel used to release a "community edition" of their C++ compiler (which is unfortunately Linux only, no Windows/Mac).
Now, it seems that you either have to purchase it, or apply the education/open source contributor license.

aw27

  • Guest
Re: What is the fastest C/C++ compiler
« Reply #20 on: March 18, 2019, 02:59:11 AM »
It is a bit hidden but exists.

Free Community License
Use Intel® System Studio with a free community license backed by community forum support. This license allows you to use the software for 90 days. You can refresh the license an unlimited number of times, allowing you to use the latest version. Convert to a paid license at any time, which provides Priority Support for one year
.
 

aw27

  • Guest
Re: What is the fastest C/C++ compiler
« Reply #21 on: March 18, 2019, 04:05:15 AM »

Again, it's a pity that C/C++ is such a mess - cryptic error messages all over the place...
Code: [Select]
C:\TDM-GCC-32\bin\gcc.exe  -O3 -s -o tmp.exe "Tmp.cpp" -lquadmath
____________________
Tmp.cpp:6:33: error: conflicting declaration of 'char* getcpuBrandString(char*)' with 'C' linkage
  char *getcpuBrandString(char *s);
                                 ^
In file included from Tmp.cpp:1:0:
commonHeader_1.h:11:7: note: previous declaration with 'C++' linkage
 char *getcpuBrandString(char *s);
       ^
Tmp.cpp: In function 'float determinant(float*, int)':
Tmp.cpp:40:67: error: '_alloca' was not declared in this scope
   minorMat = (float*)_alloca((rows - 1)*(rows - 1) * sizeof(float));
                                                                   ^

This works:
F:\mingw-w64\i686-8.1.0-win32-dwarf-rt_v6-rev0\mingw32\bin\gcc.exe -O3 main.c helper.c -o mingw32.exe

for 64-bit:
F:\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin\gcc.exe -O3 main.c helper.c -o mingw.exe

Caché GB

  • Member
  • **
  • Posts: 109
  • MASM IS HOT
Re: What is the fastest C/C++ compiler
« Reply #22 on: March 18, 2019, 05:23:03 AM »
Code: [Select]

Determinant of Matrix using C/C++ is 109746246742754830000000.00.

Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
C compiler: gcc 7.0 patchlevel 0
Elapsed time: 8336.429293 miliseconds

Caché GB's 1 and 0-nly language:MASM

jj2007

  • Member
  • *****
  • Posts: 13937
  • Assembly is fun ;-)
    • MasmBasic
Re: What is the fastest C/C++ compiler
« Reply #23 on: March 18, 2019, 05:34:37 AM »
This works:
F:\mingw-w64\i686-8.1.0-win32-dwarf-rt_v6-rev0\mingw32\bin\gcc.exe -O3 main.c helper.c -o mingw32.exe

for 64-bit:
F:\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin\gcc.exe -O3 main.c helper.c -o mingw.exe

gcc.exe -O3 main.c helper.c -o mingw32.exe
C:\Users\Jochen\AppData\Local\Temp\ccvWYXHh.o:main.c:(.text.startup+0xc0): undefined reference to `getcpuBrandString'
collect2.exe: error: ld returned 1 exit status

aw27

  • Guest
Re: What is the fastest C/C++ compiler
« Reply #24 on: March 18, 2019, 05:41:17 AM »
This works:
F:\mingw-w64\i686-8.1.0-win32-dwarf-rt_v6-rev0\mingw32\bin\gcc.exe -O3 main.c helper.c -o mingw32.exe

for 64-bit:
F:\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin\gcc.exe -O3 main.c helper.c -o mingw.exe

gcc.exe -O3 main.c helper.c -o mingw32.exe
C:\Users\Jochen\AppData\Local\Temp\ccvWYXHh.o:main.c:(.text.startup+0xc0): undefined reference to `getcpuBrandString'
collect2.exe: error: ld returned 1 exit status

Now using an extremely old release to make it work for JJ  :eusa_naughty:
F:\mingw-w64\x86_64-4.8.1-release-win32-sjlj-rt_v3-rev2\bin\gcc.exe -O3 -m32 main.c helper.c -o mingw32.exe

Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
C compiler: MingW64/i686 3.0 (gcc 4.8 patchlevel 1)
Elapsed time: 8367.289800 miliseconds

64-bit:
F:\mingw-w64\x86_64-4.8.1-release-win32-sjlj-rt_v3-rev2\bin\gcc.exe -O3 main.c helper.c -o mingw.exe

Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
C compiler: MingW64/x64 3.0 (gcc 4.8 patchlevel 1)
Elapsed time: 6691.113800 miliseconds

Caché GB

  • Member
  • **
  • Posts: 109
  • MASM IS HOT
Re: What is the fastest C/C++ compiler
« Reply #25 on: March 18, 2019, 06:21:58 AM »
On Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz

tcc32-0927.exe
Code: [Select]
Determinant of Matrix using C/C++ is -357684673432237420000000.00.

C compiler: Unknown
Elapsed time: 26079.192079 miliseconds

tcc64-0927.exe
Code: [Select]
Determinant of Matrix using C/C++ is -125780655690461880000000.00.

C compiler: Unknown
Elapsed time: 23693.694751 miliseconds
Caché GB's 1 and 0-nly language:MASM

aw27

  • Guest
Re: What is the fastest C/C++ compiler
« Reply #26 on: March 18, 2019, 07:00:27 AM »
TinyC is not an optimizing compiler. Times have changed.

aw27

  • Guest
Re: What is the fastest C/C++ compiler
« Reply #27 on: March 21, 2019, 06:59:54 PM »
MSVC and Intel compilers can also do Profile Guided Optimization which can boost performance in a large program. However, on small programs it can even have adverse effects. Still, I made a small test with the MSVC on my demos, results were inconclusive for the 64-bit but I noticed a little improvement of almost 5% for the 32-bit.

daydreamer

  • Member
  • *****
  • Posts: 2395
  • my kind of REAL10 Blonde
Re: What is the fastest C/C++ compiler
« Reply #28 on: March 24, 2019, 02:13:52 AM »
MSVC and Intel compilers can also do Profile Guided Optimization which can boost performance in a large program. However, on small programs it can even have adverse effects. Still, I made a small test with the MSVC on my demos, results were inconclusive for the 64-bit but I noticed a little improvement of almost 5% for the 32-bit.
after working with this http://masm32.com/board/index.php?topic=7708.0,I first turned off all optimize options and just because I was curious I tried with optimizing on
does exchanging unoptimized fpu code that only use memory locations with optimized code starts to use more fpu registers and integer code goes from almost only overuse ESP to exchange several memory located variables to use registers instead really does that much as 5%?
or fpu to SSE scalar code also?
my none asm creations
http://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

aw27

  • Guest
Re: What is the fastest C/C++ compiler
« Reply #29 on: March 24, 2019, 08:20:21 AM »
after working with this http://masm32.com/board/index.php?topic=7708.0,I first turned off all optimize options and just because I was curious I tried with optimizing on
does exchanging unoptimized fpu code that only use memory locations with optimized code starts to use more fpu registers and integer code goes from almost only overuse ESP to exchange several memory located variables to use registers instead really does that much as 5%?
or fpu to SSE scalar code also?
You can ask for a listing from C/C++/Output Files/Assembler Output and see. Differences between no optimization and optimization are usually huge. However, using fpu registers or not has nothing to do with that - you select it under C/C++/Code generation/Enable Enhanced Instruction Set.