From: <kla...@us...> - 2016-06-30 21:15:09
|
Revision: 13710 http://sourceforge.net/p/vegastrike/code/13710 Author: klaussfreire Date: 2016-06-30 21:15:06 +0000 (Thu, 30 Jun 2016) Log Message: ----------- Small profile-guided optimization: Unit::nummesh() doesn't really need to be virtual, and having it so is burning lots of cycles in hot draw/physics loops, so until it becomes necessary, make it nonvirtual and inline Modified Paths: -------------- trunk/vegastrike/src/cmd/unit.cpp trunk/vegastrike/src/cmd/unit.h trunk/vegastrike/src/cmd/unit_generic.h Modified: trunk/vegastrike/src/cmd/unit.cpp =================================================================== --- trunk/vegastrike/src/cmd/unit.cpp 2016-06-30 21:13:28 UTC (rev 13709) +++ trunk/vegastrike/src/cmd/unit.cpp 2016-06-30 21:15:06 UTC (rev 13710) @@ -116,13 +116,6 @@ } template < class UnitType > -unsigned int GameUnit< UnitType >::nummesh() const -{ - // return number of meshes but not the shield - return (this->meshdata.size() - 1 ); -} - -template < class UnitType > void GameUnit< UnitType >::UpgradeInterface( Unit *baseun ) { string basename = ( ::getCargoUnitName( baseun->getFullname().c_str() ) ); Modified: trunk/vegastrike/src/cmd/unit.h =================================================================== --- trunk/vegastrike/src/cmd/unit.h 2016-06-30 21:13:28 UTC (rev 13709) +++ trunk/vegastrike/src/cmd/unit.h 2016-06-30 21:15:06 UTC (rev 13710) @@ -72,7 +72,10 @@ GameUnit( const char *filename, bool SubUnit, int faction, std::string customizedUnit = std::string( "" ), Flightgroup *flightgroup = NULL, int fg_subnumber = 0, std::string *netxml = NULL ); virtual ~GameUnit(); - unsigned int nummesh() const; + unsigned int nummesh() const + { + return UnitType::nummesh(); + } ///fils in corner_min,corner_max and radial_size ///returns -1 if unit cannot dock, otherwise returns which dock it can dock at UnitImages< void >& GetImageInformation(); Modified: trunk/vegastrike/src/cmd/unit_generic.h =================================================================== --- trunk/vegastrike/src/cmd/unit_generic.h 2016-06-30 21:13:28 UTC (rev 13709) +++ trunk/vegastrike/src/cmd/unit_generic.h 2016-06-30 21:15:06 UTC (rev 13710) @@ -504,7 +504,7 @@ void RemoveFromSystem(); void RequestPhysics(); //Requeues the unit so that it is simulated ASAP bool InCorrectStarSystem( StarSystem* ); - virtual unsigned int nummesh() const + unsigned int nummesh() const { // Return number of meshes except shield return ( meshdata.size() - 1 ); |