Skip to content
Snippets Groups Projects
Commit 71dc7b78 authored by scott snyder's avatar scott snyder Committed by Scott Snyder
Browse files

Compile GeoShapeShift::contains() with optimization, even in dbg builds.

This is used heavily by the MC volume() integration.
This change speeds up the test in ActsMuonDetectorTest in the dbg build
by a factor of more than 30 (from ~8200s to ~250s).
parent ded9bf6d
No related branches found
No related tags found
1 merge request!409Compile GeoShapeShift::contains() with optimization, even in dbg builds.
Pipeline #10002900 passed
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
# Find the header and source files. # Find the header and source files.
file( GLOB SOURCES src/*.cxx ) file( GLOB SOURCES src/*.cxx )
...@@ -26,6 +26,7 @@ if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) ...@@ -26,6 +26,7 @@ if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
set_source_files_properties( set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/src/GeoXF.cxx ${CMAKE_CURRENT_SOURCE_DIR}/src/GeoXF.cxx
${CMAKE_CURRENT_SOURCE_DIR}/src/GeoAlignableTransform.cxx ${CMAKE_CURRENT_SOURCE_DIR}/src/GeoAlignableTransform.cxx
${CMAKE_CURRENT_SOURCE_DIR}/src/GeoShapeShift.cxx
PROPERTIES PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" COMPILE_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
COMPILE_DEFINITIONS "FLATTEN" ) COMPILE_DEFINITIONS "FLATTEN" )
......
/* /*
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
*/ */
#include "GeoModelKernel/GeoShapeShift.h" #include "GeoModelKernel/GeoShapeShift.h"
...@@ -53,6 +53,14 @@ void GeoShapeShift::extent (double& xmin, double& ymin, double& zmin, ...@@ -53,6 +53,14 @@ void GeoShapeShift::extent (double& xmin, double& ymin, double& zmin,
} }
} }
#if defined(FLATTEN) && defined(__GNUC__)
// We compile this package with optimization, even in debug builds; otherwise,
// the heavy use of Eigen makes it too slow. However, from here we may call
// to out-of-line Eigen code that is linked from other DSOs; in that case,
// it would not be optimized. Avoid this by forcing all Eigen code
// to be inlined here if possible.
__attribute__ ((flatten))
#endif
bool GeoShapeShift::contains (double x, double y, double z) const { bool GeoShapeShift::contains (double x, double y, double z) const {
const GeoShape* shape = getOp(); const GeoShape* shape = getOp();
const GeoTrf::Transform3D& trans = getX(); const GeoTrf::Transform3D& trans = getX();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment