Jump to content
Sign in to follow this  

Understanding limitations of compiled CfgFunctions

Recommended Posts



I'd like some help understanding observations made whilst benchmarking a few performance scenarios. These scenarios (and the observations below) involve functions exceeding a 1Mb file size.


NB: I appreciate this is both horribly unrealistic and horrendously bad practice - I am not actually implementing in this way, I was merely using them to stress performance limits and in doing so came across something that now bugs my curiosity.




When using the CfgFunctions library to pre-compile:

  • the function !isNil
  • the function typeName is CODE
  • diag_log-ing the function shows a some sort of header
  • diag_log-ing the function shows the content is missing
  • executing the function does nothing


The RPT output looks like this:

12:24:29 {
	_fnc_scriptNameParentTemp = if !(isnil '_fnc_scriptName') then {_fnc_scriptName} else {'fnc_test'};
	private ['_fnc_scriptNameParent'];
	_fnc_scriptNameParent = _fnc_scriptNameParentTemp;
	_fnc_scriptNameParentTemp = nil;

	private ['_fnc_scriptName'];
	_fnc_scriptName = 'fnc_test';
	scriptname _fnc_scriptName;

When using compileFinal preprocessFileLineNumers on a sqf declaring an identical function:

  • the function !isNil
  • the function typeName is CODE
  • diag_log-ing the function shows no header, just the script
  • diag_log-ing the function shows the content intact
  • executing the function works as expected




Reducing the file size to around 700K has both scenarios working as expected.


The RPT output of the first scenario adds the body of the script (until the diag_log limit is reached) prefixed by #line 1 and the path to fn_test.sqf





An example function would be:

fnc_test = {
    diag_log "--function running---";

    private ["_test"];

    // line below is repeated enough times to pad the file size
    _test = "fsdjagfhjgfhjgfhagfsgfgsafgasfkgahskdjhkjasghjasgvfhjgasfhjgasfhjgasfdhgasfhgaskgfhkjagfdkahjgfkjagsdfkjagsdfkjagfkjgha";

    diag_log _test;

The above script is included in an sqf for the second example. The version used for CfgFunctions obviously doesn't have the wrapping class name etc.






So, questions are:

  • why does this happen?
  • is it something similar to strings having maximum sizes?
  • is there a known hard limit at which this happens?


Thank you.


Share this post

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now
Sign in to follow this