RaphaelRoyerRivard / MicroMachine

Starcraft 2 Bot
MIT License
15 stars 0 forks source link

Investigate slow code #879

Open RaphaelRoyerRivard opened 4 years ago

RaphaelRoyerRivard commented 4 years ago

There was a 1.5s lag caused by the combat analyzer (happened twice)

27657: CCBot::drawProfilingInfo | 0.0 OnStep took 1415.363037ms
27657: CCBot::drawProfilingInfo | 0.10 m_gameCommander.onFrame took 27.332001ms
27657: CCBot::drawProfilingInfo | 0.10.1   handleUnitAssignments took 0.050000ms
27657: CCBot::drawProfilingInfo | 0.10.2   m_productionManager.onFrame took 0.097000ms
27657: CCBot::drawProfilingInfo | 0.10.4   m_combatCommander.onFrame took 27.181002ms
27657: CCBot::drawProfilingInfo | 0.10.4.0    updateInfluenceMaps took 0.289000ms
27657: CCBot::drawProfilingInfo | 0.10.4.0.1      resetInfluenceMaps took 0.131000ms
27657: CCBot::drawProfilingInfo | 0.10.4.0.2      updateInfluenceMapsWithUnits took 0.155000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1    CalcBestFlyingCycloneHelpers took 0.081000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.1      updateUnits took 0.035000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.3      SetSquadTargets took 0.033000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Backup took 24.647001ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Harass1 took 0.165000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro MainAttack took 0.090000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Scout took 0.015000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1        HarassLogicForUnit took 24.756001ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.0          getTarget took 0.679000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.1          getThreats took 0.334000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.2          ShouldUnitHeal took 0.239000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.4          ShouldAttackTarget took 0.002000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5          ThreatFighting took 23.075001ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.1          CalcCloseUnits took 1.856000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.2          CalcThreats took 1.133000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.3          CalcThreatsPower took 0.444000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.4          SimulateCombat took 0.291000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.6          UnitAbilities took 0.003000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding took 0.039000ms
27657: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 55 took 0.039000ms
27657: CCBot::drawProfilingInfo | 0.10.4.2    updateSquads took 0.339000ms
27657: CCBot::drawProfilingInfo | 0.10.4.2.1    updateDefenseBuildings took 0.007000ms
27657: CCBot::drawProfilingInfo | 0.10.4.2.2    updateDefenseSquads took 0.136000ms
27657: CCBot::drawProfilingInfo | 0.10.4.2.2.1      detectEnemiesInRegions took 0.090000ms
27657: CCBot::drawProfilingInfo | 0.10.4.2.2.3      clearRegion took 0.015000ms
27657: CCBot::drawProfilingInfo | 0.10.4.2.3    updateHarassSquads took 0.008000ms
27657: CCBot::drawProfilingInfo | 0.10.4.2.3.0     calcEnemies took 0.037000ms
27657: CCBot::drawProfilingInfo | 0.10.4.2.3.1     simulateCombat took 0.047000ms
27657: CCBot::drawProfilingInfo | 0.10.4.3    m_squadData.onFrame took 25.031002ms
27657: CCBot::drawProfilingInfo | 0.10.4.4    checkUnitsState took 1386.873047ms
27657: CCBot::drawProfilingInfo | 0.10.4.4.1      resetStates took 0.009000ms
27657: CCBot::drawProfilingInfo | 0.10.4.4.2      updateStates took 1386.849121ms
27657: CCBot::drawProfilingInfo | 0.10.4.4.2.1        addState took 0.005000ms
27657: CCBot::drawProfilingInfo | 0.10.4.4.3      removeStates took 0.010000ms
27657: CCBot::drawProfilingInfo | 0.11 m_repairStations.onFrame took 0.004000ms
27657: CCBot::drawProfilingInfo | 0.12 m_combatAnalyzer.onFrame took 1386.922119ms
27657: CCBot::drawProfilingInfo | 0.2 setUnits took 0.325000ms
27657: CCBot::drawProfilingInfo | 0.2.1   identifyEnemyRepairingSCVs took 0.010000ms
27657: CCBot::drawProfilingInfo | 0.2.1 loopAllUnits took 0.113000ms
27657: CCBot::drawProfilingInfo | 0.2.2   identifyEnemySCVBuilders took 0.004000ms
27657: CCBot::drawProfilingInfo | 0.2.2 clearDeadUnits took 0.018000ms
27657: CCBot::drawProfilingInfo | 0.2.3   identifyEnemyWorkersGoingIntoRefinery took 0.004000ms
27657: CCBot::drawProfilingInfo | 0.2.3 clearDuplicateUnits took 0.115000ms
27657: CCBot::drawProfilingInfo | 0.5 m_unitInfo.onFrame took 0.364000ms
27657: CCBot::drawProfilingInfo | 0.6 m_bases.onFrame took 0.164000ms
27657: CCBot::drawProfilingInfo | 0.6.2   resetBaseLocations took 0.002000ms
27657: CCBot::drawProfilingInfo | 0.6.3   updateBaseLocations took 0.150000ms
27657: CCBot::drawProfilingInfo | 0.6.4   updateEnemyBaseLocations took 0.001000ms
27657: CCBot::drawProfilingInfo | 0.6.7   setOccupiedBaseLocations took 0.005000ms
27657: CCBot::drawProfilingInfo | 0.7 m_workers.onFrame took 0.105000ms
27657: CCBot::drawProfilingInfo | 0.7.1   m_workerData.updateAllWorkerData took 0.017000ms
27657: CCBot::drawProfilingInfo | 0.7.2   handleMineralWorkers took 0.005000ms
27657: CCBot::drawProfilingInfo | 0.7.3   handleGasWorkers took 0.019000ms
27657: CCBot::drawProfilingInfo | 0.7.4   handleIdleWorkers took 0.005000ms
27657: CCBot::drawProfilingInfo | 0.7.5   repairCombatBuildings took 0.019000ms
27657: CCBot::drawProfilingInfo | 0.7.7   handleRepairWorkers took 0.032000ms
27657: CCBot::drawProfilingInfo | 0.8 m_buildings.onFrame took 0.110000ms
27657: CCBot::drawProfilingInfo | 0.8.1 updateBaseBuildings took 0.009000ms
27657: CCBot::drawProfilingInfo | 0.8.2 validateWorkersAndBuildings took 0.002000ms
27657: CCBot::drawProfilingInfo | 0.8.3.1.1 getRefineryPosition took 0.006000ms
27657: CCBot::drawProfilingInfo | 0.8.4 constructAssignedBuildings took 0.055000ms
27657: CCBot::drawProfilingInfo | 0.8.5 checkForStartedConstruction took 0.002000ms
27657: CCBot::drawProfilingInfo | 0.8.8 castBuildingsAbilities took 0.034000ms
27657: CCBot::drawProfilingInfo | 2.0 manageBuildOrderQueue took 0.094000ms
27657: CCBot::drawProfilingInfo | 2.1   putImportantBuildOrderItemsInQueue took 0.068000ms
27657: CCBot::drawProfilingInfo | 2.2   checkQueue took 0.024000ms
27657: CCBot::drawProfilingInfo | 2.2.2     tryingToBuild took 0.010000ms
27657: CCBot::drawProfilingInfo | 2.2.4     Build with premovement took 0.009000ms
27657: CCBot::drawProfilingInfo | 2.2.5     getNextBuildingLocation took 0.007000ms
27657: CCBot::drawProfilingInfo | getRefineryPosition took 0.005000ms

and a 2.5s lag caused by DefensivePathFinding

31891: CCBot::drawProfilingInfo | 0.0 OnStep took 2510.115234ms
31891: CCBot::drawProfilingInfo | 0.10 m_gameCommander.onFrame took 2508.591064ms
31891: CCBot::drawProfilingInfo | 0.10.1   handleUnitAssignments took 0.037000ms
31891: CCBot::drawProfilingInfo | 0.10.2   m_productionManager.onFrame took 6.803000ms
31891: CCBot::drawProfilingInfo | 0.10.4   m_combatCommander.onFrame took 2501.747070ms
31891: CCBot::drawProfilingInfo | 0.10.4.0    updateInfluenceMaps took 0.219000ms
31891: CCBot::drawProfilingInfo | 0.10.4.0.1      resetInfluenceMaps took 0.120000ms
31891: CCBot::drawProfilingInfo | 0.10.4.0.2      updateInfluenceMapsWithUnits took 0.095000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1    CalcBestFlyingCycloneHelpers took 0.110000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.1      updateUnits took 0.050000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.3      SetSquadTargets took 0.034000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Backup took 0.104000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Base Defense 91 126 took 3.945000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Base Defense 98 130 took 2494.657227ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro MainAttack took 0.098000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Scout took 0.008000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1        HarassLogicForUnit took 2498.582031ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.0          getTarget took 1.087000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.1          getThreats took 0.409000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.2          ShouldUnitHeal took 0.221000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.4          ShouldAttackTarget took 0.003000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5          ThreatFighting took 4.302000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.1          CalcCloseUnits took 2.303000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.2          CalcThreats took 0.967000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.6          UnitAbilities took 0.015000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding took 2.358000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 35 took 0.533000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 57 took 1.822000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 692 took 0.001000ms
31891: CCBot::drawProfilingInfo | 0.10.4.1.5.1.9          DefensivePathfinding took 2489.268066ms
31891: CCBot::drawProfilingInfo | 0.10.4.2    updateSquads took 0.618000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.1    updateDefenseBuildings took 0.008000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.2    updateDefenseSquads took 0.465000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.2.1      detectEnemiesInRegions took 0.096000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.2.3      clearRegion took 0.019000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.2.3      createSquad took 0.002000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.2.4      calculateRegionInformation took 0.007000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.2.5      calculateRegionsScores took 0.102000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.2.6      affectUnits took 0.199000ms
31891: CCBot::drawProfilingInfo | 0.10.4.2.3    updateHarassSquads took 0.006000ms
31891: CCBot::drawProfilingInfo | 0.10.4.3    m_squadData.onFrame took 2498.953125ms
31891: CCBot::drawProfilingInfo | 0.10.4.4    checkUnitsState took 0.195000ms
31891: CCBot::drawProfilingInfo | 0.10.4.4.1      resetStates took 0.008000ms
31891: CCBot::drawProfilingInfo | 0.10.4.4.2      updateStates took 0.183000ms
31891: CCBot::drawProfilingInfo | 0.10.4.4.3      removeStates took 0.002000ms
31891: CCBot::drawProfilingInfo | 0.11 m_repairStations.onFrame took 0.005000ms
31891: CCBot::drawProfilingInfo | 0.12 m_combatAnalyzer.onFrame took 0.225000ms
31891: CCBot::drawProfilingInfo | 0.2 setUnits took 0.292000ms
31891: CCBot::drawProfilingInfo | 0.2.1   identifyEnemyRepairingSCVs took 0.005000ms
31891: CCBot::drawProfilingInfo | 0.2.1 loopAllUnits took 0.112000ms
31891: CCBot::drawProfilingInfo | 0.2.2   identifyEnemySCVBuilders took 0.002000ms
31891: CCBot::drawProfilingInfo | 0.2.2 clearDeadUnits took 0.017000ms
31891: CCBot::drawProfilingInfo | 0.2.3   identifyEnemyWorkersGoingIntoRefinery took 0.003000ms
31891: CCBot::drawProfilingInfo | 0.2.3 clearDuplicateUnits took 0.095000ms
31891: CCBot::drawProfilingInfo | 0.5 m_unitInfo.onFrame took 0.447000ms
31891: CCBot::drawProfilingInfo | 0.6 m_bases.onFrame took 0.220000ms
31891: CCBot::drawProfilingInfo | 0.6.2   resetBaseLocations took 0.002000ms
31891: CCBot::drawProfilingInfo | 0.6.3   updateBaseLocations took 0.205000ms
31891: CCBot::drawProfilingInfo | 0.6.4   updateEnemyBaseLocations took 0.001000ms
31891: CCBot::drawProfilingInfo | 0.6.7   setOccupiedBaseLocations took 0.005000ms
31891: CCBot::drawProfilingInfo | 0.7 m_workers.onFrame took 0.141000ms
31891: CCBot::drawProfilingInfo | 0.7.1   m_workerData.updateAllWorkerData took 0.018000ms
31891: CCBot::drawProfilingInfo | 0.7.2   handleMineralWorkers took 0.009000ms
31891: CCBot::drawProfilingInfo | 0.7.3   handleGasWorkers took 0.023000ms
31891: CCBot::drawProfilingInfo | 0.7.4   handleIdleWorkers took 0.006000ms
31891: CCBot::drawProfilingInfo | 0.7.5   repairCombatBuildings took 0.010000ms
31891: CCBot::drawProfilingInfo | 0.7.7   handleRepairWorkers took 0.065000ms
31891: CCBot::drawProfilingInfo | 0.8 m_buildings.onFrame took 0.163000ms
31891: CCBot::drawProfilingInfo | 0.8.1 updateBaseBuildings took 0.010000ms
31891: CCBot::drawProfilingInfo | 0.8.2 validateWorkersAndBuildings took 0.003000ms
31891: CCBot::drawProfilingInfo | 0.8.3.1 getBuildingLocation took 0.289000ms
31891: CCBot::drawProfilingInfo | 0.8.3.1.3 getBuildLocationNear took 0.288000ms
31891: CCBot::drawProfilingInfo | 0.8.3.2 IsPathToGoalSafe took 4.000000ms
31891: CCBot::drawProfilingInfo | 0.8.4 constructAssignedBuildings took 0.086000ms
31891: CCBot::drawProfilingInfo | 0.8.5 checkForStartedConstruction took 0.002000ms
31891: CCBot::drawProfilingInfo | 0.8.6 checkForDeadTerranBuilders took 0.017000ms
31891: CCBot::drawProfilingInfo | 0.8.8 castBuildingsAbilities took 0.036000ms
31891: CCBot::drawProfilingInfo | 1.0 lowPriorityChecks took 4.348000ms
31891: CCBot::drawProfilingInfo | 2.0 manageBuildOrderQueue took 2.452000ms
31891: CCBot::drawProfilingInfo | 2.1   putImportantBuildOrderItemsInQueue took 0.067000ms
31891: CCBot::drawProfilingInfo | 2.2   checkQueue took 2.382000ms
31891: CCBot::drawProfilingInfo | 2.2.2     tryingToBuild took 2.356000ms
31891: CCBot::drawProfilingInfo | 2.2.3     Build without premovement took 2.351000ms

and a 58s lag caused by the build order queue

50065: CCBot::drawProfilingInfo | 0.0 OnStep took 58615.621094ms
50065: CCBot::drawProfilingInfo | 0.10 m_gameCommander.onFrame took 58449.218750ms
50065: CCBot::drawProfilingInfo | 0.10.1   handleUnitAssignments took 0.052000ms
50065: CCBot::drawProfilingInfo | 0.10.2   m_productionManager.onFrame took 58441.171875ms
50065: CCBot::drawProfilingInfo | 0.10.4   m_combatCommander.onFrame took 7.992001ms
50065: CCBot::drawProfilingInfo | 0.10.4.0    updateInfluenceMaps took 0.129000ms
50065: CCBot::drawProfilingInfo | 0.10.4.0.1      resetInfluenceMaps took 0.116000ms
50065: CCBot::drawProfilingInfo | 0.10.4.0.2      updateInfluenceMapsWithUnits took 0.009000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1    CalcBestFlyingCycloneHelpers took 0.156000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.1      updateUnits took 0.063000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.3      SetSquadTargets took 0.009000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Backup took 1.075000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro MainAttack took 4.226000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Scout took 0.063000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5.1        HarassLogicForUnit took 5.313000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5.1.0          getTarget took 0.011000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5.1.1          getThreats took 0.003000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5.1.2          ShouldUnitHeal took 4.855000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5          ThreatFighting took 0.025000ms
50065: CCBot::drawProfilingInfo | 0.10.4.1.5.1.6          UnitAbilities took 0.001000ms
50065: CCBot::drawProfilingInfo | 0.10.4.2    updateSquads took 0.330000ms
50065: CCBot::drawProfilingInfo | 0.10.4.2.1    updateDefenseBuildings took 0.003000ms
50065: CCBot::drawProfilingInfo | 0.10.4.2.2    updateDefenseSquads took 0.145000ms
50065: CCBot::drawProfilingInfo | 0.10.4.2.2.1      detectEnemiesInRegions took 0.070000ms
50065: CCBot::drawProfilingInfo | 0.10.4.2.2.3      clearRegion took 0.036000ms
50065: CCBot::drawProfilingInfo | 0.10.4.2.3    updateHarassSquads took 0.005000ms
50065: CCBot::drawProfilingInfo | 0.10.4.2.3.0     calcEnemies took 0.005000ms
50065: CCBot::drawProfilingInfo | 0.10.4.2.3.1     simulateCombat took 0.027000ms
50065: CCBot::drawProfilingInfo | 0.10.4.3    m_squadData.onFrame took 5.490000ms
50065: CCBot::drawProfilingInfo | 0.10.4.4    checkUnitsState took 0.228000ms
50065: CCBot::drawProfilingInfo | 0.10.4.4.1      resetStates took 0.009000ms
50065: CCBot::drawProfilingInfo | 0.10.4.4.2      updateStates took 0.214000ms
50065: CCBot::drawProfilingInfo | 0.10.4.4.3      removeStates took 0.002000ms
50065: CCBot::drawProfilingInfo | 0.11 m_repairStations.onFrame took 0.009000ms
50065: CCBot::drawProfilingInfo | 0.12 m_combatAnalyzer.onFrame took 0.261000ms
50065: CCBot::drawProfilingInfo | 0.2 setUnits took 0.169000ms
50065: CCBot::drawProfilingInfo | 0.2.1   identifyEnemyRepairingSCVs took 0.003000ms
50065: CCBot::drawProfilingInfo | 0.2.1 loopAllUnits took 0.084000ms
50065: CCBot::drawProfilingInfo | 0.2.2 clearDeadUnits took 0.010000ms
50065: CCBot::drawProfilingInfo | 0.2.3 clearDuplicateUnits took 0.041000ms
50065: CCBot::drawProfilingInfo | 0.5 m_unitInfo.onFrame took 0.562000ms
50065: CCBot::drawProfilingInfo | 0.6 m_bases.onFrame took 0.535000ms
50065: CCBot::drawProfilingInfo | 0.6.2   resetBaseLocations took 0.003000ms
50065: CCBot::drawProfilingInfo | 0.6.3   updateBaseLocations took 0.517000ms
50065: CCBot::drawProfilingInfo | 0.6.7   setOccupiedBaseLocations took 0.006000ms
50065: CCBot::drawProfilingInfo | 0.7 m_workers.onFrame took 164.479004ms
50065: CCBot::drawProfilingInfo | 0.7.1   m_workerData.updateAllWorkerData took 0.021000ms
50065: CCBot::drawProfilingInfo | 0.7.2   handleMineralWorkers took 0.012000ms
50065: CCBot::drawProfilingInfo | 0.7.3   handleGasWorkers took 0.021000ms
50065: CCBot::drawProfilingInfo | 0.7.4   handleIdleWorkers took 0.006000ms
50065: CCBot::drawProfilingInfo | 0.7.5   repairCombatBuildings took 0.014000ms
50065: CCBot::drawProfilingInfo | 0.7.6   lowPriorityChecks took 164.322006ms
50065: CCBot::drawProfilingInfo | 0.7.7   handleRepairWorkers took 0.074000ms
50065: CCBot::drawProfilingInfo | 0.8 m_buildings.onFrame took 0.372000ms
50065: CCBot::drawProfilingInfo | 0.8.0 lowPriorityChecks took 0.161000ms
50065: CCBot::drawProfilingInfo | 0.8.1 updateBaseBuildings took 0.012000ms
50065: CCBot::drawProfilingInfo | 0.8.2 validateWorkersAndBuildings took 0.003000ms
50065: CCBot::drawProfilingInfo | 0.8.3.1 getBuildingLocation took 0.017000ms
50065: CCBot::drawProfilingInfo | 0.8.3.1.1 getRefineryPosition took 0.013000ms
50065: CCBot::drawProfilingInfo | 0.8.3.1.2 getNextExpansionPosition took 0.002000ms
50065: CCBot::drawProfilingInfo | 0.8.4 constructAssignedBuildings took 0.132000ms
50065: CCBot::drawProfilingInfo | 0.8.5 checkForStartedConstruction took 0.009000ms
50065: CCBot::drawProfilingInfo | 0.8.8 castBuildingsAbilities took 0.047000ms
50065: CCBot::drawProfilingInfo | 0.9 m_strategy.onFrame took 0.001000ms
50065: CCBot::drawProfilingInfo | 2.0 manageBuildOrderQueue took 58441.167969ms
50065: CCBot::drawProfilingInfo | 2.1   putImportantBuildOrderItemsInQueue took 0.063000ms
50065: CCBot::drawProfilingInfo | 2.2   checkQueue took 58441.101563ms
50065: CCBot::drawProfilingInfo | 2.2.2     tryingToBuild took 58441.035156ms
50065: CCBot::drawProfilingInfo | 2.2.3     Build without premovement took 58441.027344ms
50065: CCBot::drawProfilingInfo | getRefineryPosition took 0.012000ms
RaphaelRoyerRivard commented 4 years ago

Something not logged from the combat commander took 5s

19608: CCBot::drawProfilingInfo | 0.0 OnStep took 5180.201172ms
19608: CCBot::drawProfilingInfo | 0.10 m_gameCommander.onFrame took 5179.375488ms
19608: CCBot::drawProfilingInfo | 0.10.1   handleUnitAssignments took 0.028000ms
19608: CCBot::drawProfilingInfo | 0.10.4   m_combatCommander.onFrame took 5179.342285ms
19608: CCBot::drawProfilingInfo | 0.10.4.0    updateInfluenceMaps took 0.886000ms
19608: CCBot::drawProfilingInfo | 0.10.4.0.1      resetInfluenceMaps took 0.347000ms
19608: CCBot::drawProfilingInfo | 0.10.4.0.2      updateInfluenceMapsWithUnits took 0.532000ms
19608: CCBot::drawProfilingInfo | 0.10.4.0.3      updateInfluenceMapsWithEffects took 0.001000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1    CalcBestFlyingCycloneHelpers took 0.118000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.1      updateUnits took 0.065000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.3      SetSquadTargets took 0.052000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.4      ExecuteMeleeMicro took 0.003000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Backup took 3.988000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro MainAttack took 11.425000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Scout took 0.313000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1        HarassLogicForUnit took 15.442000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.0          getTarget took 1.301000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.1          getThreats took 0.734000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.2          ShouldUnitHeal took 0.899000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.4          ShouldAttackTarget took 0.003000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5          ThreatFighting took 7.699000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.1          CalcCloseUnits took 2.630000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.2          CalcThreats took 2.304000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.3          CalcThreatsPower took 0.421000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5.4          SimulateCombat took 0.587000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.6          UnitAbilities took 0.008000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding took 3.920000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 35 took 0.097000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 49 took 0.171000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 692 took 3.649000ms
19608: CCBot::drawProfilingInfo | 0.10.4.1.5.1.8          PotentialFields took 0.004000ms
19608: CCBot::drawProfilingInfo | 0.10.4.2    updateSquads took 0.844000ms
19608: CCBot::drawProfilingInfo | 0.10.4.2.1    updateDefenseBuildings took 0.013000ms
19608: CCBot::drawProfilingInfo | 0.10.4.2.2    updateDefenseSquads took 0.277000ms
19608: CCBot::drawProfilingInfo | 0.10.4.2.2.1      detectEnemiesInRegions took 0.169000ms
19608: CCBot::drawProfilingInfo | 0.10.4.2.2.3      clearRegion took 0.055000ms
19608: CCBot::drawProfilingInfo | 0.10.4.2.3    updateHarassSquads took 0.015000ms
19608: CCBot::drawProfilingInfo | 0.10.4.2.3.0     calcEnemies took 0.074000ms
19608: CCBot::drawProfilingInfo | 0.10.4.2.3.1     simulateCombat took 0.298000ms
19608: CCBot::drawProfilingInfo | 0.10.4.3    m_squadData.onFrame took 15.914001ms
19608: CCBot::drawProfilingInfo | 0.10.4.4    checkUnitsState took 0.204000ms
19608: CCBot::drawProfilingInfo | 0.10.4.4.1      resetStates took 0.008000ms
19608: CCBot::drawProfilingInfo | 0.10.4.4.2      updateStates took 0.189000ms
19608: CCBot::drawProfilingInfo | 0.10.4.4.2.1        addState took 0.007000ms
19608: CCBot::drawProfilingInfo | 0.10.4.4.2.2        updateState took 0.014000ms
19608: CCBot::drawProfilingInfo | 0.10.4.4.3      removeStates took 0.002000ms
19608: CCBot::drawProfilingInfo | 0.11 m_repairStations.onFrame took 0.003000ms
19608: CCBot::drawProfilingInfo | 0.12 m_combatAnalyzer.onFrame took 0.231000ms
19608: CCBot::drawProfilingInfo | 0.2 setUnits took 0.290000ms
19608: CCBot::drawProfilingInfo | 0.2.1   identifyEnemyRepairingSCVs took 0.010000ms
19608: CCBot::drawProfilingInfo | 0.2.1 loopAllUnits took 0.099000ms
19608: CCBot::drawProfilingInfo | 0.2.2   identifyEnemySCVBuilders took 0.003000ms
19608: CCBot::drawProfilingInfo | 0.2.2 clearDeadUnits took 0.016000ms
19608: CCBot::drawProfilingInfo | 0.2.3   identifyEnemyWorkersGoingIntoRefinery took 0.003000ms
19608: CCBot::drawProfilingInfo | 0.2.3 clearDuplicateUnits took 0.104000ms
19608: CCBot::drawProfilingInfo | 0.5 m_unitInfo.onFrame took 0.199000ms
19608: CCBot::drawProfilingInfo | 0.6 m_bases.onFrame took 0.033000ms
19608: CCBot::drawProfilingInfo | 0.6.2   resetBaseLocations took 0.002000ms
19608: CCBot::drawProfilingInfo | 0.6.3   updateBaseLocations took 0.019000ms
19608: CCBot::drawProfilingInfo | 0.6.4   updateEnemyBaseLocations took 0.002000ms
19608: CCBot::drawProfilingInfo | 0.6.7   setOccupiedBaseLocations took 0.005000ms
19608: CCBot::drawProfilingInfo | 0.7 m_workers.onFrame took 0.017000ms
19608: CCBot::drawProfilingInfo | 0.7.1   m_workerData.updateAllWorkerData took 0.015000ms
RaphaelRoyerRivard commented 4 years ago

Combat simulation took 1s

24902: CCBot::drawProfilingInfo | 0.0 OnStep took 1023.253052ms
24902: CCBot::drawProfilingInfo | 0.10 m_gameCommander.onFrame took 1022.327026ms
24902: CCBot::drawProfilingInfo | 0.10.1   handleUnitAssignments took 0.036000ms
24902: CCBot::drawProfilingInfo | 0.10.4   m_combatCommander.onFrame took 1022.286072ms
24902: CCBot::drawProfilingInfo | 0.10.4.0    updateInfluenceMaps took 0.171000ms
24902: CCBot::drawProfilingInfo | 0.10.4.0.1      resetInfluenceMaps took 0.141000ms
24902: CCBot::drawProfilingInfo | 0.10.4.0.2      updateInfluenceMapsWithUnits took 0.027000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1    CalcBestFlyingCycloneHelpers took 0.134000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.1      updateUnits took 0.056000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.3      SetSquadTargets took 0.017000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.4      ExecuteMeleeMicro took 0.001000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Backup took 9.587001ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Base Defense 117 60 took 0.096000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro MainAttack took 0.379000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro Scout took 0.056000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1        HarassLogicForUnit took 10.023001ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.0          getTarget took 0.100000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.1          getThreats took 0.080000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.2          ShouldUnitHeal took 3.665000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.4          ShouldAttackTarget took 0.001000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.5          ThreatFighting took 5.296000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.6          UnitAbilities took 0.065000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding took 0.185000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 34 took 0.036000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 57 took 0.145000ms
24902: CCBot::drawProfilingInfo | 0.10.4.1.5.1.9          DefensivePathfinding took 0.090000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2    updateSquads took 1009.840027ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.1    updateDefenseBuildings took 0.003000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.2    updateDefenseSquads took 0.223000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.2.1      detectEnemiesInRegions took 0.068000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.2.3      clearRegion took 0.018000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.2.3      createSquad took 0.001000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.2.4      calculateRegionInformation took 0.004000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.2.5      calculateRegionsScores took 0.064000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.2.6      affectUnits took 0.005000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.3    updateHarassSquads took 0.005000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.3.0     calcEnemies took 0.017000ms
24902: CCBot::drawProfilingInfo | 0.10.4.2.3.1     simulateCombat took 1009.481018ms
24902: CCBot::drawProfilingInfo | 0.10.4.3    m_squadData.onFrame took 10.241000ms
24902: CCBot::drawProfilingInfo | 0.10.4.4    checkUnitsState took 0.203000ms
24902: CCBot::drawProfilingInfo | 0.10.4.4.1      resetStates took 0.009000ms
24902: CCBot::drawProfilingInfo | 0.10.4.4.2      updateStates took 0.189000ms
24902: CCBot::drawProfilingInfo | 0.10.4.4.2.2        updateState took 0.002000ms
24902: CCBot::drawProfilingInfo | 0.10.4.4.3      removeStates took 0.002000ms
24902: CCBot::drawProfilingInfo | 0.11 m_repairStations.onFrame took 0.006000ms
24902: CCBot::drawProfilingInfo | 0.12 m_combatAnalyzer.onFrame took 0.241000ms
24902: CCBot::drawProfilingInfo | 0.2 setUnits took 0.329000ms
24902: CCBot::drawProfilingInfo | 0.2.1   identifyEnemyRepairingSCVs took 0.004000ms
24902: CCBot::drawProfilingInfo | 0.2.1 loopAllUnits took 0.189000ms
24902: CCBot::drawProfilingInfo | 0.2.2   identifyEnemySCVBuilders took 0.002000ms
24902: CCBot::drawProfilingInfo | 0.2.2 clearDeadUnits took 0.014000ms
24902: CCBot::drawProfilingInfo | 0.2.3   identifyEnemyWorkersGoingIntoRefinery took 0.002000ms
24902: CCBot::drawProfilingInfo | 0.2.3 clearDuplicateUnits took 0.078000ms
24902: CCBot::drawProfilingInfo | 0.5 m_unitInfo.onFrame took 0.269000ms
24902: CCBot::drawProfilingInfo | 0.6 m_bases.onFrame took 0.040000ms
24902: CCBot::drawProfilingInfo | 0.6.2   resetBaseLocations took 0.002000ms
24902: CCBot::drawProfilingInfo | 0.6.3   updateBaseLocations took 0.026000ms
24902: CCBot::drawProfilingInfo | 0.6.4   updateEnemyBaseLocations took 0.001000ms
24902: CCBot::drawProfilingInfo | 0.6.7   setOccupiedBaseLocations took 0.005000ms
24902: CCBot::drawProfilingInfo | 0.7 m_workers.onFrame took 0.021000ms
24902: CCBot::drawProfilingInfo | 0.7.1   m_workerData.updateAllWorkerData took 0.019000ms
RaphaelRoyerRivard commented 4 years ago

0.4 m_map.onFrame took 525.449036ms


15956: drawProfilingInfo | 0.10.4.1.5.1        HarassLogicForUnit took 48.306004ms
15956: drawProfilingInfo | 0.10.4.1.5.1.0          getTarget took 0.638000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.1          getThreats took 0.510000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.2          ShouldUnitHeal took 0.456000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.4          ShouldAttackTarget took 0.003000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.5          ThreatFighting took 0.941000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.5.1          CalcCloseUnits took 0.261000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.5.2          CalcThreats took 0.027000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.6          UnitAbilities took 0.008000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding took 1.880000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 35 took 0.061000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 49 took 0.252000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 57 took 0.086000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.7          OffensivePathFinding 692 took 1.447000ms
15956: drawProfilingInfo | 0.10.4.1.5.1.8          PotentialFields took 0.010000ms

Could also show the number of times the method has been called in the frame.
RaphaelRoyerRivard commented 4 years ago

Nothing show what is slow in ThreatFighting

19585: drawProfilingInfo | 0.10.4.1.5.1.5          ThreatFighting took 48.319004ms for 17 calls
19585: drawProfilingInfo | 0.10.4.1.5.1.5.1          CalcCloseUnits took 1.225000ms for 7 calls
19585: drawProfilingInfo | 0.10.4.1.5.1.5.2          CalcThreats took 0.668000ms for 6 calls
19585: drawProfilingInfo | 0.10.4.1.5.1.5.3          CalcThreatsPower took 0.141000ms for 6 calls
19585: drawProfilingInfo | 0.10.4.1.5.1.5.4          SimulateCombat took 0.142000ms for 5 calls

Same for lowPriorityChecks of workers

19585: drawProfilingInfo | 0.7 m_workers.onFrame took 35.086002ms for 1 calls
19585: drawProfilingInfo | 0.7.1   m_workerData.updateAllWorkerData took 0.084000ms for 1 calls
19585: drawProfilingInfo | 0.7.2   handleMineralWorkers took 0.008000ms for 1 calls
19585: drawProfilingInfo | 0.7.3   handleGasWorkers took 0.072000ms for 1 calls
19585: drawProfilingInfo | 0.7.4   handleIdleWorkers took 0.012000ms for 1 calls
19585: drawProfilingInfo | 0.7.5   repairCombatBuildings took 0.026000ms for 1 calls
19585: drawProfilingInfo | 0.7.6   lowPriorityChecks took 34.563004ms for 1 calls
19585: drawProfilingInfo | 0.7.7   handleRepairWorkers took 0.311000ms for 1 calls

And ExecuteCycloneLogic

19873: drawProfilingInfo | 0.10.4.1.5.1.b          ExecuteCycloneLogic took 11.977000ms for 9 calls

Also, order is bad for the combat commander

19921: drawProfilingInfo | 0.10.4   m_combatCommander.onFrame took 48.491001ms for 1 calls
19921: drawProfilingInfo | 0.10.4.1    CalcBestFlyingCycloneHelpers took 0.101000ms for 1 calls
19921: drawProfilingInfo | 0.10.4.1.5      ExecuteRangedMicro MainAttack took 39.932003ms for 1 calls
RaphaelRoyerRivard commented 4 years ago

The order is bad for the production manager


20427: drawProfilingInfo | 0.10 m_gameCommander.onFrame took 112.218002ms for 1 calls
20427: drawProfilingInfo | 0.10.2   m_productionManager.onFrame took 105.463005ms for 1 calls
20427: drawProfilingInfo | 2.0 manageBuildOrderQueue took 105.422005ms for 1 calls
20427: drawProfilingInfo | 2.2   checkQueue took 105.366005ms for 1 calls
20427: drawProfilingInfo | 2.2.2     tryingToBuild took 105.283005ms for 5 calls
20427: drawProfilingInfo | 2.2.3     Build without premovement took 104.208008ms for 4 calls
RaphaelRoyerRivard commented 4 years ago

The lag of Build without premovement is probably caused by the use of Util::PathFinding::IsPathToGoalSafe in BuildingManager::addBuildingTask.

RaphaelRoyerRivard commented 4 years ago

Because we get attacked and we have no safe place to put our buildings, getBuildLocationNear() makes the bot lag.

10583: drawProfilingInfo | 0.0 OnStep took 54.070004ms for 1 calls
10583: drawProfilingInfo | 0.10 m_gameCommander.onFrame took 53.087002ms for 1 calls
10583: drawProfilingInfo | 0.10.1   handleUnitAssignments took 0.015000ms for 1 calls
10583: drawProfilingInfo | 0.10.2   m_productionManager.onFrame took 40.625004ms for 1 calls
10583: drawProfilingInfo | 0.10.2.1    putImportantBuildOrderItemsInQueue took 0.047000ms for 1 calls
10583: drawProfilingInfo | 0.10.2.2    checkQueue took 40.531002ms for 1 calls
10583: drawProfilingInfo | 0.10.2.2.2     tryingToBuild took 40.447002ms for 8 calls
10583: drawProfilingInfo | 0.10.2.2.2.2      Build with premovement took 40.442001ms for 2 calls
10583: drawProfilingInfo | 0.10.2.2.2.2.1       getNextBuildingLocation took 40.422001ms for 2 calls
10587: drawProfilingInfo | 0.8.3.1.3 getBuildLocationNear took 36.288002ms for 1 calls

And probably the code for the wall is a bit slow.

10587: drawProfilingInfo | 0.10.4.2    updateSquads took 9.958000ms for 1 calls
10587: drawProfilingInfo | 0.10.4.2.1    updateDefenseBuildings took 9.526000ms for 1 calls
RaphaelRoyerRivard commented 4 years ago

There is also something else in the building construction that is slow

7051: drawProfilingInfo | 0.10 m_gameCommander.onFrame took 106.451004ms for 1 calls
7051: drawProfilingInfo | 0.10.2   m_productionManager.onFrame took 104.781006ms for 1 calls
7051: drawProfilingInfo | 0.10.2.2    manageBuildOrderQueue took 104.726006ms for 1 calls
7051: drawProfilingInfo | 0.10.2.2.2     checkQueue took 104.683006ms for 1 calls
7051: drawProfilingInfo | 0.10.2.2.2.2      tryingToBuild took 104.668007ms for 2 calls
7051: drawProfilingInfo | 0.10.2.2.2.2.1      Build without premovement took 104.665009ms for 2 calls
7051: drawProfilingInfo | 0.10.2.2.2.2.1.1      canMakeNow took 104.622002ms for 1 calls

And that

11745: drawProfilingInfo | 0.10 m_gameCommander.onFrame took 84.227005ms for 1 calls
11745: drawProfilingInfo | 0.10.2   m_productionManager.onFrame took 73.855003ms for 1 calls
11745: drawProfilingInfo | 0.10.2.2    manageBuildOrderQueue took 73.814003ms for 1 calls
11745: drawProfilingInfo | 0.10.2.2.2     checkQueue took 73.768005ms for 1 calls
11745: drawProfilingInfo | 0.10.2.2.2.2      tryingToBuild took 73.744003ms for 7 calls
11745: drawProfilingInfo | 0.10.2.2.2.2.1      Build without premovement took 73.742004ms for 6 calls
11745: drawProfilingInfo | 0.10.2.2.2.2.1.2      create took 72.726006ms for 1 calls
11745: drawProfilingInfo | getRefineryPosition took 72.664001ms for 1 calls
RaphaelRoyerRivard commented 4 years ago

8928: drawProfilingInfo | 0.10.4.1.5.1.c.1           ExecuteBansheeUncloakLogic took 63.043003ms for 3 calls