Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled text wrapping on TextEdit node causes low perfomance #36287

Open
grotar00 opened this issue Feb 16, 2020 · 5 comments
Open

Enabled text wrapping on TextEdit node causes low perfomance #36287

grotar00 opened this issue Feb 16, 2020 · 5 comments

Comments

@grotar00
Copy link

grotar00 commented Feb 16, 2020

Godot version: 3.2.stable.official

OS/device including version: Windows 10 x64

Issue description: I suppose everything is just the way it is, but this was quite unexpected source of lag for my text processing app. Perfomance decrease depends on (string length / node width) ratio and gets worse if text is selected.
Gif below demonstrates CPU (left column) and GPU (rightmost column) usage (RAM is middle).
wrap-FFB
Can it be because line splits of entire string are calculated every frame? Is it possible to freeze the node unless it has focus or text is changed?

Steps to reproduce: Paste text (>10k symbols) to TextEdit node with true wrap_enabled.

Minimal reproduction project: Text Wrap Test.zip

@Calinou
Copy link
Member

Calinou commented Feb 16, 2020

I wonder if the high CPU usage is just due to the amount of draw calls. Support for 2D batching is being worked in #35957.

@lawnjelly
Copy link
Member

As well as the need for batching in the renderer as Calinou says, there may also be a problem in the way the text boxes calculate layout and cull (or don't cull) characters that are off screen.

Before it even gets to the renderer the text boxes should be:

  1. Caching the layout (as you say)
  2. Culling out lines / characters that are outside the view area of the window

I've not looked at any of the text widgets but I'm pretty sure (2) is not working correctly for some of the nodes.

@Nolkaloid
Copy link
Contributor

@grotar00 for now you can use the application/run/low_processor_mode in the project settings to improve performance.

@lawnjelly
Copy link
Member

I had another little test with this, it is approx 9x faster with batching in debug (should be faster in release) but I can't see any obvious option in the node to cull out the text that is not on screen, either with this or with label. There is a 'clip' option in label but it doesn't speed things up, it probably just activates glScissor.

So although the batching will hide it, it really should be solved within the nodes themselves imo.

@KoBeWi
Copy link
Member

KoBeWi commented Dec 21, 2020

Seems still valid in 3.2.4 beta4
Not sure about FPS, but CPU usage skyrockets when the text is filled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants