implemented cmake options to disable extra features for performances optimization

can be easily extended to all features that can be optional
but have high performance impact
This commit is contained in:
Yehonal
2017-03-25 12:35:51 +01:00
parent 12fa25c322
commit 2f71abc6c6
3 changed files with 44 additions and 16 deletions

View File

@@ -1,10 +1,12 @@
option(SERVERS "Build worldserver and authserver" 1) option(SERVERS "Build worldserver and authserver" 1)
option(SCRIPTS "Build core with scripts included" 1) option(SCRIPTS "Build core with scripts included" 1)
option(TOOLS "Build map/vmap/mmap extraction/assembler tools" 0) option(TOOLS "Build map/vmap/mmap extraction/assembler tools" 0)
option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" 1) option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" 1)
option(USE_COREPCH "Use precompiled headers when compiling servers" 1) option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
option(WITH_WARNINGS "Show all warnings during compile" 0) option(WITH_WARNINGS "Show all warnings during compile" 0)
option(WITH_COREDEBUG "Include additional debug-code in core" 0) option(WITH_COREDEBUG "Include additional debug-code in core" 0)
option(WITH_PERFTOOLS "Enable compilation with gperftools libraries included" 0) option(WITH_PERFTOOLS "Enable compilation with gperftools libraries included" 0)
option(WITH_MESHEXTRACTOR "Build meshextractor (alpha)" 0) option(WITH_MESHEXTRACTOR "Build meshextractor (alpha)" 0)
option(WITHOUT_GIT "Disable the GIT testing routines" 0) option(WITHOUT_GIT "Disable the GIT testing routines" 0)
option(DISABLE_EXTRAS "Set to 1 to disable extra features optimizing performances" 0)
option(DISABLE_VMAP_CHECKS "Remove DisableMgr Checks on vmap" 0)

View File

@@ -124,8 +124,10 @@ namespace VMAP
bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2) bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2)
{ {
//if (!isLineOfSightCalcEnabled() || DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) // pussywizard: optimization #if defined(DISABLE_EXTRAS) || defined(DISABLE_VMAP_CHECKS)
// return true; if (!isLineOfSightCalcEnabled() || DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS))
return true;
#endif
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
if (instanceTree != iInstanceMapTrees.end()) if (instanceTree != iInstanceMapTrees.end())
@@ -147,7 +149,9 @@ namespace VMAP
*/ */
bool VMapManager2::getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist) bool VMapManager2::getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist)
{ {
//if (isLineOfSightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) // pussywizard: optimization #if defined(DISABLE_EXTRAS) || defined(DISABLE_VMAP_CHECKS)
if (isLineOfSightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS))
#endif
{ {
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
if (instanceTree != iInstanceMapTrees.end()) if (instanceTree != iInstanceMapTrees.end())
@@ -177,7 +181,9 @@ namespace VMAP
float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist) float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist)
{ {
//if (isHeightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT)) // pussywizard: optimization #if defined(DISABLE_EXTRAS) || defined(DISABLE_VMAP_CHECKS)
if (isHeightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT))
#endif
{ {
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
if (instanceTree != iInstanceMapTrees.end()) if (instanceTree != iInstanceMapTrees.end())
@@ -196,7 +202,9 @@ namespace VMAP
bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
{ {
//if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG)) // pussywizard: optimization #if defined(DISABLE_EXTRAS) || defined(DISABLE_VMAP_CHECKS)
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG))
#endif
{ {
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId); InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
if (instanceTree != iInstanceMapTrees.end()) if (instanceTree != iInstanceMapTrees.end())
@@ -214,7 +222,9 @@ namespace VMAP
bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const
{ {
//if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS)) // pussywizard: optimization #if defined(DISABLE_EXTRAS) || defined(DISABLE_VMAP_CHECKS)
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS))
#endif
{ {
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId); InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
if (instanceTree != iInstanceMapTrees.end()) if (instanceTree != iInstanceMapTrees.end())

View File

@@ -105,5 +105,21 @@ if ( NOJEM )
message(" *** DO NOT DISABLE IT UNLESS YOU KNOW WHAT YOU'RE DOING!") message(" *** DO NOT DISABLE IT UNLESS YOU KNOW WHAT YOU'RE DOING!")
endif() endif()
# Performance optimization options:
if( DISABLE_EXTRAS )
message("* Disable extra features : Yes")
add_definitions(-DDISABLE_EXTRAS)
else()
message("* Disable extra features : No (default)")
endif()
if( DISABLE_VMAP_CHECKS )
message("* Disable vmap DisableMgr checks : Yes")
add_definitions(-DDISABLE_VMAP_CHECKS)
else()
message("* Disable vmap DisableMgr checks : No (default)")
endif()
message("") message("")