3

I am not a C or C++ programmer myself, but I often use software that needs to be compiled or otherwise depends on a compiler, like some R packages.

Will that software actually perform better if I use a newer/better compiler? For instance, right now I use the Mac OS X system version of Clang, and it's been suggested that I use a later version instead. Is that just a suggestion to save me time and memory during compilation? Or will it actually produce more efficient compiled software?

shadowtalker
  • 356
  • 2
  • 11
  • 1
    For the person voting to close as "belongs on SO": this is not a development-related question; this is asking from a user's perspective (note: there are many OSes and software packages that expect the user to compile from source). It would be off-topic on SO, and *is* on-topic on SU; close reasons are far more nuanced than "he mentioned compiling!". – Bob Jun 10 '15 at 14:26
  • 1
    @Bob thank you. I had actually written this on StackOverflow originally, and then decided to post it here instead – shadowtalker Jun 10 '15 at 14:26
  • @fixer1234 I've specifically added C and C++ to the title and tags – shadowtalker Jun 10 '15 at 15:13
  • @fixer1234 you're reading way too far into the question. If the answer is "there's no good answer" then so be it – shadowtalker Jun 10 '15 at 15:46

1 Answers1

3

Will that software actually perform better if I use a newer/better compiler?

This entirely depends on if work is done to the code optimization feature, of the compiler, in a given release.

For instance, right now I use the Mac OS X system version of Clang, and it's been suggested that I use a later version instead.

You should stick with the same compiler version that you know works, unless you need a feature, that exists only in a later version. Unless you know a later version does something more effective you should not upgrade.

Is that just a suggestion to save me time and memory during compilation?

The suggestion honestly seems 100% opionion based. If you trust the person that provided this suggestion then you should take it.

I should point out that a compiler, is software, and newer versions can introduce new bugs which result in worst performance in the optimization routinue. You should seek a balance, the best way to do this, is always use the stable release build.

Ramhound
  • 41,734
  • 35
  • 103
  • 130
  • Good answer, but would be useful to mention that while it's often a bad idea to upgrade out-of-band without good reason, you should still perform upgrades that are part of the official OS release. Also, sometimes newer compiler releases actually introduce regressions (they can do a *worse* job of optimising certain code than an older release). – Bob Jun 10 '15 at 14:30
  • What I see here is a tentative "no". Or "maybe, but probably not enough to matter and you might break something in the process." Accurate? – shadowtalker Jun 10 '15 at 14:32
  • @Ramhound: according to the question, the OP is doing the compiling. – fixer1234 Jun 10 '15 at 15:04
  • @Ramhound you have it backwards. I don't usually compile my own code (R is an interpreted language; I use Python as well), but I am occasionally required to build add-on packages from source, which must be compiled before I can use them. I do also use a program called Stan for which I do need to compile C++ code, albeit automatically generated C++ code. – shadowtalker Jun 10 '15 at 15:13
  • @Ramhound: I have problems with the question, but your answer is good. +1 – fixer1234 Jun 10 '15 at 15:39