Significantly slower code when compiling with G++ instead of LLVM

Louis-Philippe

I am experimenting with an algorithm I programmed in C++ using XCode 7.0. When I compare the performance of the standard LLVM compiler in XCode to the binary created when compiling using G++ (5.2.0) the binary created using LLVM is an order of magnitude (>10x) faster than the code created using the g++ compiler.

I am using the -o3 code optimisation flag for the g++ compiler as follows:

/usr/local/Cellar/gcc/5.2.0/bin/g++-5 -o3 -fopenmp -DNDEBUG main.cpp \
PattersonInstance.cpp \
... \
-o RROTprog

The g++ compilation is needed because the algorithm has to be compiled and run on a high performance computer where I cannot use the LLVM compiler. Plus I would like to use Open MP to make the code faster.

All ideas on the reason what is causing these speed differences and how they could be resolved is more than welcome.

Thanks in advance for the help!

L

vsoftco

I can bet that what happens is the following: you pass -o3 to the compiler, instead of -O3 (i.e. with CAPITAL O) and for this reason -o3 just instructs the compiler to output the executable to a file called "3". However you use -o RROTprog later in the same command line, and the last -o is the one that's considered by the compiler when outputting the executable.

The net effect: the -O3 is not present, hence no optimization is being done.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why is principalsearcher code significantly slower

From Dev

Why is principalsearcher code significantly slower

From Dev

Program SIGNIFICANTLY slower when used from the TTY

From Dev

meaning of llvm[n] when compiling llvm, where n is an integer

From Java

Compiling multithread code with g++

From Dev

Why this code is getting slower when I use std::algorithms instead of plain loops?

From Dev

Why repeating a kernel inside a for-loop makes CUDA code significantly slower?

From Dev

Are there alternate libraries to LLVM that are built for compiling a specific IR to architecture specfic code?

From Dev

Forcing "char" to be "unsigned char" when compiling with xcodes LLVM compiler

From Dev

IOException when dynamically compiling code

From Dev

Options when compiling R code

From Dev

Eclipse Compiling C Code With G++ not GCC

From Java

Significantly slower for loop after using variables in Julia

From Dev

Is Polymorphism (significantly)slower than direct implementations?

From Dev

Cuda compiling error when coming to g++ compiling step

From Dev

Unknown pragma when compiling OpenMP with g++

From Dev

'undefined reference to' when compiling with g++

From Dev

Error when compiling cpp file with g++

From Dev

Unknown pragma when compiling OpenMP with g++

From Dev

Undefined reference when compiling C code

From Dev

Access Denied when compiling c code with gcc

From Dev

when compiling the code into apk the pictures wont display

From Dev

Correct arguments in code, wrong argument when compiling

From Dev

Why are entity queries significantly slower than projections in Breeze?

From Java

Jersey2 @BeanParam being significantly slower than the alternative

From Dev

HTTPClient 4.x - first http request significantly slower

From Dev

Process.Start() significantly slower than executing in console

From Dev

Why is the short primitive type significantly slower than long or int?

From Dev

Jersey2 @BeanParam being significantly slower than the alternative

Related Related

  1. 1

    Why is principalsearcher code significantly slower

  2. 2

    Why is principalsearcher code significantly slower

  3. 3

    Program SIGNIFICANTLY slower when used from the TTY

  4. 4

    meaning of llvm[n] when compiling llvm, where n is an integer

  5. 5

    Compiling multithread code with g++

  6. 6

    Why this code is getting slower when I use std::algorithms instead of plain loops?

  7. 7

    Why repeating a kernel inside a for-loop makes CUDA code significantly slower?

  8. 8

    Are there alternate libraries to LLVM that are built for compiling a specific IR to architecture specfic code?

  9. 9

    Forcing "char" to be "unsigned char" when compiling with xcodes LLVM compiler

  10. 10

    IOException when dynamically compiling code

  11. 11

    Options when compiling R code

  12. 12

    Eclipse Compiling C Code With G++ not GCC

  13. 13

    Significantly slower for loop after using variables in Julia

  14. 14

    Is Polymorphism (significantly)slower than direct implementations?

  15. 15

    Cuda compiling error when coming to g++ compiling step

  16. 16

    Unknown pragma when compiling OpenMP with g++

  17. 17

    'undefined reference to' when compiling with g++

  18. 18

    Error when compiling cpp file with g++

  19. 19

    Unknown pragma when compiling OpenMP with g++

  20. 20

    Undefined reference when compiling C code

  21. 21

    Access Denied when compiling c code with gcc

  22. 22

    when compiling the code into apk the pictures wont display

  23. 23

    Correct arguments in code, wrong argument when compiling

  24. 24

    Why are entity queries significantly slower than projections in Breeze?

  25. 25

    Jersey2 @BeanParam being significantly slower than the alternative

  26. 26

    HTTPClient 4.x - first http request significantly slower

  27. 27

    Process.Start() significantly slower than executing in console

  28. 28

    Why is the short primitive type significantly slower than long or int?

  29. 29

    Jersey2 @BeanParam being significantly slower than the alternative

HotTag

Archive