Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3271 closed Enhancement (fixed)

Don't override user compiler optimization flags

Reported by: Astara Owned by: charles
Priority: Low Milestone: 2.00
Component: Transmission Version: 1.93
Severity: Minor Keywords: development, optimization, compiler
Cc:

Description

When I looked at the optimization in doing local builds, I noted it was set for -O3. I've would like to suggest a slightly different option and some default tuning options. Some of the -O3 options can result in worse performance due to their using more memory and possibly hurting cache performance. Thus, in the kernel, they generally try to use -O2 and add further optimizations that won't increase memory usage. In my own use I add switches to allow unrolling some invariant code in loops, figuring it is small, but probably worth the faster code.

Specifically, I've been using (-O2 +..) -fbranch-target-load-optimize2 -fgcse -fgcse-las -fgcse-lm -f gcse-sm -fpredictive-commoning -frename-registers -fstack-protector -ftracer -ftree-loop-distribution -ftree-vectorize -funswitch-loops -funwind-tables -fvariable-expansion-in-unroller -fvpt -fweb

For my own builds I use -march=native, but that assumes that you are running on the same arch as you build on (true for me, but maybe not in general).

Change History (5)

comment:1 Changed 11 years ago by charles

Reading through the thread in http://www.mail-archive.com/autoconf@gnu.org/msg14330.html it makes me wonder if we'd be better off removing those optimization settings altogether since the packagers, builders, and installers know their platforms better than autoconf does.

comment:2 Changed 11 years ago by charles

  • Milestone changed from None Set to 2.00
  • Owner set to charles
  • Status changed from new to assigned
  • Summary changed from RFE .. suggest different optimization options on linux to Don't override user compiler optimization flags

comment:3 Changed 11 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in trunk for 2.00 by r10733

comment:4 Changed 11 years ago by Astara

...but this doesn't indicate what is done in the default case where the user has not specified options... -O3 isn't the best choice for a default. -O2 + [some option set, possibly 'null] might be more prudent.

comment:5 Changed 11 years ago by charles

autoconf uses "-g -O2" by default because it is known to be safe on the majority of platforms and therefore is likely to be safe as a compromise between "optimization" and "non-optimization".

Note: See TracTickets for help on using tickets.