Page MenuHomeFeedback Tracker

Multi line text controls becomes slower the more text is in it
Closed, ResolvedPublic

Description

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.

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Ingame UI
Steps To Reproduce

For Multi Line Text

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

For CT_TREE, CT_LIST behaves the same

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

Additional Information

Version 2.01.146823

Event Timeline

R3vo created this task.Nov 4 2020, 2:32 PM
R3vo edited Steps To Reproduce. (Show Details)Nov 4 2020, 2:36 PM
R3vo edited Additional Information. (Show Details)
R3vo edited Steps To Reproduce. (Show Details)
R3vo edited Additional Information. (Show Details)
R3vo edited Steps To Reproduce. (Show Details)
R3vo edited Steps To Reproduce. (Show Details)Nov 6 2020, 6:52 PM
R3vo edited Steps To Reproduce. (Show Details)
R3vo edited Steps To Reproduce. (Show Details)
R3vo edited Steps To Reproduce. (Show Details)Nov 6 2020, 8:47 PM
Leopard20 added a subscriber: Leopard20.EditedNov 6 2020, 10:05 PM

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];
}
R3vo updated the task description. (Show Details)Nov 7 2020, 10:31 AM
R3vo added a comment.Nov 7 2020, 10:43 AM

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

Is this fixable?

dedmen added a subscriber: dedmen.Nov 24 2020, 1:47 PM

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.

dedmen claimed this task.Nov 24 2020, 1:47 PM
dedmen changed the task status from New to Assigned.
dedmen set Ref Ticket to AIII-53560.
dedmen changed the task status from Assigned to Feedback.Nov 26 2020, 10:13 AM

Proifling v7

R3vo added a comment.Dec 3 2020, 2:59 PM

Fix confirmed.

LouMontana closed this task as Resolved.Feb 24 2021, 2:14 PM