View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0027417 | Community | OCCT:Configuration | public | 2016-04-22 13:05 | 2020-07-21 12:43 |
Reporter | BenjaminBihler | Assigned To | bugmaster | ||
Priority | normal | Severity | tweak | ||
Status | closed | Resolution | fixed | ||
Platform | MinGW-w64 | OS | Windows | ||
Target Version | 7.1.0 | Fixed in Version | 7.1.0 | ||
Summary | 0027417: Choose a Better Default Release Optimization Parameter for MinGW-w64 | ||||
Description | In 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 Reproduce | Not necessary | ||||
Tags | No tags attached. | ||||
Test case number | |||||
|
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. |
|
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. |
|
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 |
|
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? |
|
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 |
|
Now it works! My editor here displays absolutely no difference between O and zero. ;-) |
|
Great! :) grateful to you for the participation :) |
|
dear bugmaster, please integrate the fix |
|
Branch CR27417 has been deleted by inv. SHA-1: 06d29f0f8160766bccb9c5977ca0aa6b87f782c1 |
occt: master a139a353 2016-04-22 10:07:52 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 |
Affected Issues 0027417 |
|
mod - adm/cmake/occt_defs_flags.cmake | Diff File |
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 | |
2016-04-22 13:16 |
|
Assigned To | bugmaster => ibs |
2016-04-25 11:14 |
|
Note Added: 0053534 | |
2016-04-25 11:14 |
|
Assigned To | ibs => BenjaminBihler |
2016-04-25 11:14 |
|
Status | resolved => feedback |
2016-04-25 11:14 |
|
Relationship added | related to 0027319 |
2016-04-25 11:46 | BenjaminBihler | Note Added: 0053537 | |
2016-04-25 11:56 |
|
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 |
|
Note Added: 0053546 | |
2016-04-25 12:09 |
|
Note Added: 0053547 | |
2016-04-25 12:09 |
|
Assigned To | BenjaminBihler => bugmaster |
2016-04-25 12:09 |
|
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 |
|
Status | verified => closed |
2016-12-09 16:37 |
|
Fixed in Version | => 7.1.0 |
2020-07-21 12:43 | kgv | Relationship added | parent of 0031677 |