The more lines a text control contains the slower rendering becomes. This only is an issue when it's placed inside a controls group.
The size seems to influence this as well. The performance impact is lower if text size is small.
The more lines a text control contains the slower rendering becomes. This only is an issue when it's placed inside a controls group.
The size seems to influence this as well. The performance impact is lower if text size is small.
Execute the following code in Eden Editor:
disableSerialization; private _longestLineWidth = 0; private _exampleString = "abcdefghijklmnopqrstuvxyz0134567890"; private _text = ""; for "_lines" from 1 to 4000 do { _lineText = _exampleString select [round random 35]; _text = _text + _lineText + endl; }; private _display = findDisplay 313 createDisplay "RscDisplayEmpty"; private _group = _display ctrlCreate ["RscControlsGroup", -1]; private _edit = _display ctrlCreate ["RscEditMulti", -1,_group]; _group ctrlSetPosition [0,0,1,1]; _group ctrlCommit 0; _edit ctrlSetPosition [0,0,1,2]; _edit ctrlSetBackgroundColor [0,0,0,1]; _edit ctrlSetFontHeight 0.03; _edit ctrlSetText _text; _edit ctrlSetPositionH ctrlTextHeight _edit; _edit ctrlCommit 0;
In this example FPS drop from 60 to 6 for me
The same seems to be the case for listboxes and treeViews. The more entries they have, the slower they becomes. Also it becomes worse when scrolling down. Adding picture right or picture left to the entries also seems to have a massive impact on performance.
[] spawn { disableSerialization; _display = findDisplay 313 createDisplay "RscDisplayEmpty"; _edit = _display ctrlCreate ["RscEdit", 645]; _edit ctrlSetPosition [0,0,1,0.04]; _edit ctrlSetBackgroundColor [0,0,0,1]; _edit ctrlCommit 0; _tv = _display ctrlCreate ["RscTreeSearch", -1]; _tv ctrlSetFont "EtelkaMonospacePro"; _tv ctrlSetFontHeight 0.01; _tv ctrlSetPosition [0,0.06,1,0.94]; _tv ctrlSetBackgroundColor [0,0,0,1]; _tv ctrlCommit 0; _classes = "true" configClasses (configFile >> "CfgVehicles"); for "_i" from 0 to 5000 do { _tv tvAdd [[], configName selectRandom _classes]; }; };
Here is a demon video on profiling branch (See the FPS in the bottom right):
https://www.youtube.com/watch?v=ZnQrVShe9_w
Version 2.01.146823
This only is an issue when it's placed inside a controls group.
I can reproduce the issue without a controlsGroup:
_d = findDisplay 46 createDisplay "RscDisplayEmpty"; _c = _d ctrlCreate ["RscTree", -1]; ctrlSetFocus _c; for "_i" from 0 to 10000 do { _c tvAdd [[], str _i]; }
Quote from Killzone_Kid
This has nothing to do with ct_tree, this happens to any multi line control with too many lines, they are still rendering even if not visible. No provision for that was added when classes were written.
Source: https://discord.com/channels/105462288051380224/108187245529268224/774564891515551755
Multi line text controls
already fixed in last dev-branch, CTree is seperate tho
No provision for that was added when classes were written.
That's incorrect, a check is there to not render stuff out of view. Problem is it doesn't respect the scroll bar of the controls container.
The edit control itself, is actually full height, and thus renders all its text.
but its hidden inside a parent controls container with scroll bar that hides the majority of its content.