Page MenuHomeFeedback Tracker

.bin configs are slower to access ingame, compared to their .cpp counterparts
New, NormalPublic

Description

A rapified config.bin is slower to fetch from ingame than a plain text config.cpp that is otherwise identical.
I am told that once a config is loaded on game start, the format it came in (.bin or .cpp) is irrelevant, so the results in this post should be impossible.

Testing method:
I created a config class with 25000 identical sub classes to iterate through.

class sub_class_0
{
	string="This is a repro config to demonstrate slower config fetch times when the config is loaded from a rapified state, compared to plain text.";
	number=0;
	array[]=
	{
		"string",
		1,
		{}
	};
};

I loaded this config in two separate pbos, one using a plain text config.cpp, the other using a rapified config.bin.
The config.cpp class was called Repro_FastCppCfg, the config.bin class was called Repro_SlowBinCfg.
I tested two methods of iterating through the config classes, here are the results.

foreach + configclasses

// Repro_FastCppCfg: [68.6,15]
diag_codePerformance[{
 { 
  getText(_x >> "string"); 
  getNumber(_x >> "number"); 
  getArray(_x >> "array"); 
 } forEach ("true" configClasses (configFile >> "Repro_FastCppCfg"));
}];
// Repro_SlowBinCfg: [18126,1]
diag_codePerformance[{
 { 
  getText(_x >> "string"); 
  getNumber(_x >> "number"); 
  getArray(_x >> "array"); 
 } forEach ("true" configClasses (configFile >> "Repro_SlowBinCfg"));
}];

for + select

// Repro_FastCppCfg: [75.4286,14]
diag_codePerformance[{
 private _cfg = configFile >> "Repro_FastCppCfg"; 
 for "_i" from 0 to (count _cfg) - 1 do { 
  getText(_cfg select _i >> "string"); 
  getNumber(_cfg select _i >> "number"); 
  getArray(_cfg select _i >> "array"); 
 };
}];
// Repro_SlowBinCfg: [42910,1]
diag_codePerformance[{
 private _cfg = configFile >> "Repro_SlowBinCfg"; 
 for "_i" from 0 to (count _cfg) - 1 do { 
  getText(_cfg select _i >> "string"); 
  getNumber(_cfg select _i >> "number"); 
  getArray(_cfg select _i >> "array"); 
 };
}];

As demonstrated, despite their contents being identical, the Repro_SlowBinCfg config loaded from a rapified config.bin is much slower to fetch from than the Repro_FastCppCfg plain text config.cpp counterpart.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
10.0.18363 Build 18363
Category
Config
Steps To Reproduce

Rapify a config with properties at least two classes deep.

Load the attached repro mod and execute the code snippets from this post's description.

Additional Information

I could not replicate this issue with config properties just one class deep, and I did not test further than two deep as that is where I originally encountered this issue.

I tested with both CfgConvert and Mikero's Rapify, they had the same results.

This issue is most apparent when iterating through a high number of classes/properties, though it is also demonstrated with simple commands.

 // Repro_FastCppCfg: [0.00158,100000]
diag_codePerformance [{
getText(configFile >> "Repro_FastCppCfg" >> "sub_class_0" >> "string");
}];
// Repro_SlowBinCfg: [0.00233,100000]
diag_codePerformance [{
getText(configFile >> "Repro_SlowBinCfg" >> "sub_class_0" >> "string");
}];

Event Timeline

_connor created this task.May 1 2020, 1:39 PM
dedmen claimed this task.May 18 2020, 11:46 AM