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

Rendering of Chinese characters is very slow #962

Closed
lionelfung7 opened this issue Dec 17, 2021 · 8 comments
Closed

Rendering of Chinese characters is very slow #962

lionelfung7 opened this issue Dec 17, 2021 · 8 comments
Labels
bug Something is broken performance Lower CPU/GPU usage (optimize)

Comments

@lionelfung7
Copy link

Describe the bug

To be able to display Chinese in the UI, I added a Chinese TTF file to the fonts.rs file using the font_data.insert() method. This file contains thousands of Chinese characters and some nerd characters. I then recompiled egui_demo_app in debug mode, ran it again, and found that it was very slow to open. After opening it, I tried to enter Chinese characters in an input box and the Chinese characters displayed normally, but they also appear to be slow and sluggish.

To Reproduce
Steps to reproduce the behavior:

Expected behavior

Screenshots

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser
  • Version

Smartphone (please complete the following information):

  • Device:
  • OS:
  • Browser
  • Version

Additional context

@lionelfung7 lionelfung7 added the bug Something is broken label Dec 17, 2021
@coderedart
Copy link
Contributor

Did you try release mode? How's the CPU or GPU usage looking when you are running the app?

@emilk
Copy link
Owner

emilk commented Dec 17, 2021

Do you insert the TTF once or every frame? (I've seen people do the latter before)

@lionelfung7
Copy link
Author

Did you try release mode? How's the CPU or GPU usage looking when you are running the app?
egui

After adding Chinese TTF, it took about 10 seconds to open egui_demo_app. Attached is CPU usage. If compiled in Release mode, the opening speed increases by about 5 seconds

@lionelfung7
Copy link
Author

add_code
sarasa-mono-sc-nerd-regular.zip
Please refer to the attachment. I have added codes in these two places. I have also attached the TTF file

@emilk
Copy link
Owner

emilk commented Dec 29, 2021

I tried it locally and had no problems with performance. Make sure you compile with --release!

@emilk
Copy link
Owner

emilk commented Apr 16, 2022

Is this really an issue? If you take https://github.com/emilk/egui/blob/master/examples/custom_font/src/main.rs and modify it with your own font, does it lag? On native, web, or both? Are you using --release? Is it the IME that is lagging? Can you use a profiler (e.g. puffin) to track down the problem?

@blueberrynotblue
Copy link

mine works fine. maybe he didn't context.request_repaint?

@rdrpenguin04
Copy link

Can this be closed?

@emilk emilk closed this as completed Aug 27, 2024
@emilk emilk added the performance Lower CPU/GPU usage (optimize) label Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken performance Lower CPU/GPU usage (optimize)
Projects
None yet
Development

No branches or pull requests

5 participants