Using MTuner data from a short run of the game, we can drastically improve 0 A.D. core engine performance, by reducing the number of allocations in the detected hotspots.
For more information, check the Memory Performance thread on the forums: http://www.wildfiregames.com/forum/index.php?showtopic=17310&st=20#entry270448
Sub-tickets:
modeldef.cpp: #2006
parser.cpp: #2005
guimanager.cpp: #2007
textrenderer.cpp: #2027
<progress>, <memblock>, <total memops>, <stacktrace>
(V), size 4, count 61320, modeldef.cpp:300
(V), size 8, count 61320, modeldef.cpp:301
(V), size 48, count 42028, parser.cpp:246
(V), size 36, count 40866, guimanager.cpp:273 & 265
(V), size 8, count 32749, modeldef.cpp:241
(V), size 32, count 27638, textrenderer.cpp:136
(V), size 8, count 21952, cgui.cpp:986
(V), size 16, count 21952, textrenderer.cpp:77
( ), size 16, count 21952, shaderdefines.cpp:135
(V), size 48, count 21952, cgui.cpp:954
( ), size 12, count 20688, modelrenderer.cpp:635
( ), size 112, count 17325, guirenderer.cpp:388!)
( ), size 108, count 16896, patchrdata.cpp:173
( ), size 8, count 14852, shaderdefines.cpp:116
( ), size 48, count 14154, font.cpp:33
( ), size 36, count 13230, patchrdata.cpp:1025
(V), size 48, count 12008, parser.cpp:981
( ), size 24, count 9783, patchrdata.cpp:1025
( ), size 8, count 9645, modelrenderer.cpp:433
( ), size 8, count 8935, modelrenderer.cpp:698
( ), size 48, count 8265, cgui.cpp:916
(V), size 48, count 8144, parser.cpp:933
( ), size 93, count 7806, guitext.cpp:266
( ), size 132, count 7806, cgui.cpp:689
( ), size 132, count 7806, cgui.cpp:800 & 855
( ), size 12, count 7072, modelrenderer.cpp:636
( ), , , textrenderer.cpp:77
( ), , , textrenderer.cpp:179
( ), , , patchrdata.cpp:1052
( ), , , guitext.cpp:210
( ), , , terraintextureentry.h:75
( ), , , patchrdata.cpp:192
( ), , , cgui.cpp:675
( ), , , texturemanager.cpp:150
( ), , , texturemanager.cpp:153
( ), , , texturemanager.cpp:511
( ), , , texturemanager.h:136
(V), , , parser.cpp:639
( ), , , componentmanager.cpp:620
CModelDef fixes uploaded. This patch addresses two problems: 1) CModelDef loading performance
2) Complex dynamic objects in structs
The result: much better memory performance and usage for model loading.
In order for this to work, I had to change the version of the PMD (binary model cache) format to 4 and change the way models are saved to PMD. This may invalidate any existing model cache. Backwards compatibility for versions 1, 2, 3 is there.