MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0027417Community[OCCT] OCCT:Configurationpublic2016-04-22 13:052016-12-09 16:37
ReporterBenjaminBihler 
Assigned Tobugmaster 
PrioritynormalSeveritytweak 
StatusclosedResolutionfixed 
PlatformMinGW-w64OSWindowsOS Version
Product Version 
Target Version[OCCT] 7.1.0Fixed in Version[OCCT] 7.1.0 
Summary0027417: Choose a Better Default Release Optimization Parameter for MinGW-w64
DescriptionIn my opinion CMake is doing a bad job by proposing "-O3" as the default release optimization parameter for MinGW-w64. In my tests, the binaries become larger, but the speed is almost the same. (I have not done comparisons on Linux, there "-O3" might indeed be better than "-O2".) Also other build tools like qmake set the default optimization parameter to "-O2".

I would therefore propose to set the default release optimization parameter to "-O2", if the compiler is MinGW. Actually this parameter can easily be overwritten by the user, but this would mean proposing the optimization parameter that has been proven to be best at least in some cases.
Steps To ReproduceNot necessary
TagsNo tags attached.
Test case number
Attached Files

- Relationships
related to 0027319assignedibs Open CASCADE Configuration, Cmake - cmake's c/cxx corresponding flags are not updated in cmake gui after changes in cmake script 

-  Notes
(0053499)
git (administrator)
2016-04-22 13:09

Branch CR27417 has been created by BenjaminBihler.

SHA-1: 1524979ab2d2dcb093bbe2765c09fab0a3d1e5f5


Detailed log of new commits:

Author: Benjamin Bihler
Date: Fri Apr 22 12:07:52 2016 +0200

    0027417: Coose a Better Default Release Optimization Parameter for MinGW-w64
    
    Forcing CMAKE_CXX_FLAGS_RELEASE to -O2 -DNDEBUG, if the compiler is MinGW-w64.
(0053534)
ibs (developer)
2016-04-25 11:14

Dear Benjamin,

It will be great if you replace "-O3" with "-O2" in such way, for example:

string (REGEX MATCH "-03" IS_O3_CXX "${CMAKE_CXX_FLAGS_RELEASE}")
if (IS_O3_CXX)
  string (REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
else()
  set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
endif()

2. "FORCE" is not necessary for only one flag due to 0027319 issue will cover this omission.
(0053537)
BenjaminBihler (developer)
2016-04-25 11:46

Dear ibs,

thank you for the hint. Your solution looks nicer, I have done it the other way, since the variabled seemed not to be updated.

Still your code does not work here. I have added debug output, which leads to the following lines:

# Set default release optimization option to O2 instead of O3, since in
  # some OCCT related examples, this gives significantly smaller binaries
  # at comparable performace with MinGW-w64.
  message ("Old CMAKE_CXX_FLAGS_RELEASE variable: ${CMAKE_CXX_FLAGS_RELEASE}")
  string (REGEX MATCH "-03" IS_O3_CXX "${CMAKE_CXX_FLAGS_RELEASE}")
  message ("IS_O3_CXX: ${IS_O3_CXX}")
  if (IS_O3_CXX)
    message("Found -O3 string")
    string (REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
    message ("New variable: ${CMAKE_CXX_FLAGS_RELEASE}")
  else()
    message ("Did not find -O3 string")
    set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
  endif()




The output is

Old CMAKE_CXX_FLAGS_RELEASE variable: -O3 -DNDEBUG
IS_O3_CXX:
Did not find -O3 string

which shows that something did not work correctly, but I could not figure out what it is. Can you?


Thanks,
Benjamin
(0053542)
ibs (developer)
2016-04-25 11:56

Benjamin,

there is a doubt that ' string (REGEX MATCH "-03" IS_O3_CXX "${CMAKE_CXX_FLAGS_RELEASE}") ' contains "zero" but "O" letter. It's my fault due to the previous my example was a speculative. Could you replace "-03" with "-O3" and check again?
(0053544)
git (administrator)
2016-04-25 12:04

Branch CR27417 has been updated by BenjaminBihler.

SHA-1: 06d29f0f8160766bccb9c5977ca0aa6b87f782c1


Detailed log of new commits:

Author: Benjamin Bihler
Date: Mon Apr 25 11:04:13 2016 +0200

    0027417: Choose a Better Default Release Optimization Parameter for MinGW-w64
    
    Switched to replacing optimization parameter instead of overwriting
    CMAKE_CXX_FLAGS_RELEASE string

(0053545)
BenjaminBihler (developer)
2016-04-25 12:05

Now it works! My editor here displays absolutely no difference between O and zero. ;-)
(0053546)
ibs (developer)
2016-04-25 12:09

Great! :) grateful to you for the participation :)
(0053547)
ibs (developer)
2016-04-25 12:09

dear bugmaster, please integrate the fix
(0054204)
git (administrator)
2016-05-20 12:22

Branch CR27417 has been deleted by inv.

SHA-1: 06d29f0f8160766bccb9c5977ca0aa6b87f782c1

- Related Changesets
occt: master a139a353
Timestamp: 2016-04-22 10:07:52
Author: BenjaminBihler
Committer: bugmaster
Details ] Diff ]
0027417: Coose a Better Default Release Optimization Parameter for MinGW-w64

Forcing CMAKE_CXX_FLAGS_RELEASE to -O2 -DNDEBUG, if the compiler is MinGW-w64.

Switched to replacing optimization parameter instead of overwriting
CMAKE_CXX_FLAGS_RELEASE string
mod - adm/cmake/occt_defs_flags.cmake Diff ] File ]

- Issue History
Date Modified Username Field Change
2016-04-22 13:05 BenjaminBihler New Issue
2016-04-22 13:05 BenjaminBihler Assigned To => BenjaminBihler
2016-04-22 13:09 git Note Added: 0053499
2016-04-22 13:11 BenjaminBihler Assigned To BenjaminBihler => bugmaster
2016-04-22 13:11 BenjaminBihler Status new => resolved
2016-04-22 13:11 BenjaminBihler Steps to Reproduce Updated View Revisions
2016-04-22 13:16 abv Assigned To bugmaster => ibs
2016-04-25 11:14 ibs Note Added: 0053534
2016-04-25 11:14 ibs Assigned To ibs => BenjaminBihler
2016-04-25 11:14 ibs Status resolved => feedback
2016-04-25 11:14 ibs Relationship added related to 0027319
2016-04-25 11:46 BenjaminBihler Note Added: 0053537
2016-04-25 11:56 ibs Note Added: 0053542
2016-04-25 12:04 git Note Added: 0053544
2016-04-25 12:05 BenjaminBihler Note Added: 0053545
2016-04-25 12:09 ibs Note Added: 0053546
2016-04-25 12:09 ibs Note Added: 0053547
2016-04-25 12:09 ibs Assigned To BenjaminBihler => bugmaster
2016-04-25 12:09 ibs Status feedback => reviewed
2016-04-29 16:10 bugmaster Changeset attached => occt master a139a353
2016-04-29 16:10 bugmaster Status reviewed => verified
2016-04-29 16:10 bugmaster Resolution open => fixed
2016-05-20 12:22 git Note Added: 0054204
2016-12-09 16:31 user533 Status verified => closed
2016-12-09 16:37 user533 Fixed in Version => 7.1.0


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker