After playing with the DLL profiler it seems I have found some huge time consuming function:
Meaning that 57.3% of the Frame time (whatever it is) is spend in 9174 calls to the updatePlotGroupBonus function in my huge map at about turn 407....
After investigation all calls to updatePlotGroupBonus comes from a single function: changeRevealAllBonuses(-1) at line 1021 of the CvTeam.cpp in the CvTeam::doTurn() function.
I have created a DLL 050 without the call to changeRevealAllBonuses in CvTeam::doTurn() and basically halved the "Total Frame MS' time:
After (same turn):
I am not sure what is the use of this function but it doesn't seems to impact my game so far.
Also the overall game turn time didn't change much for me but I can see more animation going on during AI turn in the optimized version. I will keep investigating to see if I can find some more interesting candidate.
If you want to activate the profiler, compile the DLL in Release mode (not Final Release) then activate the cheat mode and the logs in the ini .
In game open the debug menu by "ctrl+shift+alt d" then in Profile check "Show DLL Profile" and "Profile Logging" see attached capture.
The profile logs are in the dllprofile.log file in your logs folder.
Code:
--------------------------------------------------
[19956.037] DBG: Total Frame MS: [B]2934.0[/B] FPS: 000 Min:067 Max:000 Avg:000 SampleFilter:1.010000
Time : Ave : Min% : Max% : Num : Profile Name
-----------------------------------------------------
[COLOR="Red"] 2934.0 : 100.0 : 100.0 : 100.0 : 001 : CvGame::doTurn()[/COLOR]
030.0 : 001.0 : 000.9 : 002.2 : 218 : CvPlot::updateSymbols
002.0 : 000.1 : 000.0 : 000.2 : 218 : CvPlot::updateSymbolDisplay
376.0 : 012.8 : 012.8 : 036.0 : 214 : CvPlot::updateFeatureSymbol
1682.0 : [B]057.3[/B] : 056.9 : 057.6 : 9174 : CvPlot::updatePlotGroupBonus
...
Meaning that 57.3% of the Frame time (whatever it is) is spend in 9174 calls to the updatePlotGroupBonus function in my huge map at about turn 407....
After investigation all calls to updatePlotGroupBonus comes from a single function: changeRevealAllBonuses(-1) at line 1021 of the CvTeam.cpp in the CvTeam::doTurn() function.
I have created a DLL 050 without the call to changeRevealAllBonuses in CvTeam::doTurn() and basically halved the "Total Frame MS' time:
After (same turn):
Code:
--------------------------------------------------
[20641.490] DBG: Total Frame MS: [B]1259.0[/B] FPS: 001 Min:071 Max:000 Avg:001 SampleFilter:1.010000
Time : Ave : Min% : Max% : Num : Profile Name
-----------------------------------------------------
[COLOR="Red"] 1259.0 : 100.0 : 099.8 : 100.0 : 001 : CvGame::doTurn()[/COLOR]
025.0 : 002.0 : 001.6 : 002.0 : 218 : CvPlot::updateSymbols
365.0 : 029.0 : 029.0 : 036.9 : 214 : CvPlot::updateFeatureSymbol
016.0 : [B]001.3[/B] : 000.0 : 001.3 : 534 : CvPlot::updatePlotGroupBonus
010.0 : 000.8 : 000.8 : 000.9 : 255 : CvPlayerAI::AI_baseBonusVal
010.0 : 000.8 : 000.8 : 000.9 : 027 : CvPlayerAI::AI_baseBonusVal::recalculate
021.0 : 001.7 : 001.7 : 001.9 : 012 : CvTeam::doTurn()
I am not sure what is the use of this function but it doesn't seems to impact my game so far.
Also the overall game turn time didn't change much for me but I can see more animation going on during AI turn in the optimized version. I will keep investigating to see if I can find some more interesting candidate.
If you want to activate the profiler, compile the DLL in Release mode (not Final Release) then activate the cheat mode and the logs in the ini .
In game open the debug menu by "ctrl+shift+alt d" then in Profile check "Show DLL Profile" and "Profile Logging" see attached capture.
The profile logs are in the dllprofile.log file in your logs folder.