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

Typing in a full TextEdit node on iOS export causes CPU Usage to rise to 100%+ and app to lag, making it unusable #84329

Open
beastly-eve opened this issue Nov 1, 2023 · 6 comments

Comments

@beastly-eve
Copy link

Godot version

3.5.3 stable, 4.1.1 stable

System information

iPadOS 16.1.1 iPad Air (3rd generation) - Exported from Apple M1 Pro 2021 running MacOS 14.1 with xcode Version 15.01

Issue description

This issue is present when exporting a godot project for iOS and then running the export on an iPad.

When a TextEdit node has around 2000 or more characters and the user tries to type into it, the project begins to significantly lag, the CPU rises to 100% and the fps drops to single digits. Key presses are delayed significantly. The TextEdit becomes unusable. This issue occurs whether the TextEdit is empty on start or pre-filled.

The expected behavior is to be able to type into a full TextEdit with the same or similar performance and responsiveness as if it was empty or mostly empty, and meet the expectation of the experience of typing multiple paragraphs of text on a device with out delays or freezing.

This issue causes any apps made with Godot that include typing long form text to be not viable.

Steps to reproduce

  1. Create an empty godot project
  2. Add a TextEdit node
  3. Put a few paragraphs in it as default text, 2,000 characters should be enough. (You can also leave it empty and type or paste the characters in it while testing the exported project)
  4. Export your project to iOS
  5. Open the exported project in xcode and build/run it on an iPad
  6. Type into the TextEdit field

Minimal reproduction project

textedit-ios-godot-3.5.3.zip
textedit-ios-godot-4.1.zip

@kyoz
Copy link

kyoz commented Jun 10, 2024

Can confirm this issue. Seem like it occur mostly when we type. I've tried to change caret position, selecting but they work just fine. Just when i start typing, the app hang, sometime crash.

@bruvzg bruvzg self-assigned this Jun 10, 2024
@Calinou
Copy link
Member

Calinou commented Jun 13, 2024

Which rendering method are you using? #92797 should greatly improve the situation when using Forward+ or Mobile. If it doesn't, then the bottleneck is coming from somewhere else in TextEdit processing (or perhaps TextServer, even).

I suggest using the Compatibility rendering method for now (make sure it's also enabled for the .mobile override of the Rendering Method project setting).

To see whether this is due to TextServer overhead, you could also compile an iOS export template with the module_text_server_adv_enabled=no module_text_server_fb_enabled=yes SCons options. This will use a simpler TextServer without support for advanced features like right-to-left typesetting and complex scripts, but it can be significantly faster when lots of text needs to be drawn.

@kyoz
Copy link

kyoz commented Jun 14, 2024

Thank you very much, @Calinou. I've tried custom iOS export template with module_text_server_adv_enabled=no module_text_server_fb_enabled=yes on Godot 3.5.3 and it seem does have a little improvement, but not much, still laggy and very delay on each word. I'll try #92797 with multiple rendering methods and let you know soon.

@kyoz
Copy link

kyoz commented Jun 18, 2024

Hello @Calinou, i'm builded a version with that pr, it's seem ok but i don't know how to set the GODOT_2D_BATCHING_DISABLED environment like he said. Tried:

OS.set_environment("GODOT_2D_BATCHING_DISABLED", "1")

But it's seem doesn't work. Tried to run Godot by cmd which is in Godot.app/Conents/MacOS/Godot but it doesn't seem have any options to set the environment there.@@

@Calinou
Copy link
Member

Calinou commented Jun 18, 2024

, it's seem ok but i don't know how to set the GODOT_2D_BATCHING_DISABLED environment like he said. Tried:

You need to set the environment variable before the project starts. This can't be done on iOS, but you don't need to set the environment variable to test the PR with batching enabled anyway, as batching is enabled by default.

@kyoz
Copy link

kyoz commented Jun 19, 2024

Then i'm afraid that the pr doesn't help :'(. The TextEdit and CodeEdit still very laggy (<10fps). I've tried your testing project (test_2d_batching_1x1_sprite.zip and it have noticeable improvement. But not the TextEdit. I think it was cause by something else. Cause it only happen on iOS, on android, window and macOS it work it great.

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