Skip to content

Commit

Permalink
Enable LTO (#37)
Browse files Browse the repository at this point in the history
This PR enable link-time-based optimizations.
The -O3 is somewhat redundant with "Release", but I threw it in there
just for good measures...


https://rebench.dev/SOMpp/compare/7490bff551ff58befee1b4586cf6c2af21975474..b493e7d08ece319387fd8895b245d7aec44dadcc
Change of Run time: median -12% (min. -26%, max. 9%)
  • Loading branch information
smarr authored Aug 2, 2024
2 parents 7490bff + b493e7d commit d58e27c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ target_include_directories(SOM++ PRIVATE ${SRC_DIR})

target_link_libraries(SOM++)

if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(SOM++ PRIVATE -O3 -flto)
target_link_options(SOM++ PRIVATE -flto)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_executable(unittests "")

Expand Down

0 comments on commit d58e27c

Please sign in to comment.