[BUG] A font-rendering performance problem (of upstream DarkPlaces) - Printable Version +- Xonotic Forums (https://forums.xonotic.org) +-- Forum: Support (https://forums.xonotic.org/forumdisplay.php?fid=3) +--- Forum: Xonotic - Help & Troubleshooting (https://forums.xonotic.org/forumdisplay.php?fid=4) +--- Thread: [BUG] A font-rendering performance problem (of upstream DarkPlaces) (/showthread.php?tid=9497) |
A font-rendering performance problem (of upstream DarkPlaces) - NaitLee - 08-12-2022 Note: the actual problem is found, and is of upstream (DarkPlaces engine) I've reported it to DP's GitHub issue. See that instead, below is left for historical reason. The problem: Rendering some text/characters that "vary a lot" can cause Xonotic to lag for a few frames. But that's enough to ruin experience! Please, for knowing "whether it's only me", do a test: A good case of "vary a lot" is Japanese text. Start Xonotic, in Settings > User > Text Language list, scroll down and switch to 日本語. Fear not, you are already familiar with the game. Now go ahead for a match.
Note that the extreme case is Chinese. For more significant effect, you can find its "full" translation in my another thread and test with 中文 The problem is there on both of my computers, with Intel or Nvidia GPU/Driver, with both Windows (7 and 10) and Linux (Arch- and Debian-based distros and OpenSUSE in both X11 and Wayland). Nothing weird was reported in console. Using another ttf font (other than Unifont) doesn't solve these. If it happened to be true to you, leave a reply, and:
Thank you! PS. I guess to pre-render most of the text and cache them in memory in background can let it behave better. But just guess... RE: Help me to test (then report) a font-rendering performance problem - NaitLee - 08-12-2022 Sorry, I should add that I'm using Xonotic 0.8.5 release, not newest Git version. I'll try to compile Xonotic from Git as early as possible. RE: Help me to test (then report) a font-rendering performance problem - FAF - 08-13-2022 (08-12-2022, 11:50 AM)NaitLee Wrote: Sorry, I should add that I'm using Xonotic 0.8.5 release, not newest Git version. Can you provide more specs on the CPU and Hard disk? SSD vs HDD, etc. RE: Help me to test (then report) a font-rendering performance problem - NaitLee - 08-13-2022 My Laptop: 8x Intel® Core™ i5-10210U CPU @ 1.60GHz 7.5 GiB DDR4 RAM M.2 nvme SSD My another machine: 3x AMD Athlon @ 3.4GHz 6 GB DDR3 RAM Typical old-aged HDD Both have this problem. Further trials: using Unifont along (no fallbacks in font-xolonium.cfg) and/or putting font file in a tmpfs (mount to "~/.xonotic/data/fonts") don't solve this. RE: Help me to test (then report) a font-rendering performance problem - FAF - 08-14-2022 (08-13-2022, 03:42 AM)NaitLee Wrote: My Laptop:Yea, the specs seems ok, though a little low on the CPU on the Intel, but hey, should run good. Are you using the internal GPU on both? Have you tried with a better GPU? RE: Help me to test (then report) a font-rendering performance problem - NaitLee - 08-14-2022 Hey, I mean it's Xonotic have problem, not my computers. The easiest way to "help" is to test those I've said in #1, to see if it's (also) laggy on your side. RE: Help me to test (then report) a font-rendering performance problem - FAF - 08-14-2022 (08-14-2022, 03:08 AM)NaitLee Wrote: Hey, I mean it's Xonotic have problem, not my computers. Sure, I hear you, was just wondering if an external GPU could handle the rendering better? RE: Help me to test (then report) a font-rendering performance problem - NaitLee - 08-14-2022 Okay My Nvidia GPU can even afford "Ultimate" effect preset flawlessly. But won't prevent this problem from appearing. ("OMG!" preset can't either) I can hear CPU fan rawring when lagging on the cases. (I know I should see system monitor instead. maybe later when I play) So I guess it's Xonotic doesn't handle "font processing" with "optimization" to wide range of Unicode chars, currently. (Sorry for poor terms. Maybe I should browse Xonotic source code, but that's my another struggle) btw game logic (server) isn't affected, just dropped some graphical frames. RE: Help me to test (then report) a font-rendering performance problem - FAF - 08-15-2022 (08-14-2022, 04:00 AM)NaitLee Wrote: Okay Thanks. Yea, been going through the DarkPlacesEngine issues list and can see that they are working on optimizing it. https://github.com/DarkPlacesEngine/darkplaces/issues "DP has multithreading with the taskqueue subsystem, but it's currently under-utilized." Further than that, I do not know about CH fonts or if it related to multithreading at all, but it could sound like it, with the throttling and all. RE: Help me to test (then report) a font-rendering performance problem - NaitLee - 08-15-2022 Thanks for the info! In my mind threading is too heavy to solve *this* problem: there are so many strings. Coroutines are moderate but DarkPlace/Xonotic isn't in Golang Pre-rendering should be fine, and if true it can be a special option for CJK languages. From dev tracing log in console I see the texts are rendered on-demand, i.e. when they should be shown in the next frame. Diverse as CJK characters slowed it down. I'm wanting to look into the actual code, and may edit by myself to see what will happen It shouldn't be too difficult, but I'm just busy setting up my PC for reality reasons. RE: Help me to test (then report) a font-rendering performance problem - NaitLee - 08-18-2022 FINALLY I got the chance to compile Xonotic from git, investigate the code and run it. And I got to know where's the problem, which is totally of DarkPlaces. So, upstream. I'll report it later It isn't easy to fix anyway. But if you want to learn more anyway, go ahead.
First consider English. Even if going to render all I said above, DP just cache the less-than-128 ascii letters, and use it all the way. Now comes Chinese. Consider simple as "我爱你" ("I love you"), DP will cache all of the following: Code: 戀戁戂戃戄戅戆戇戈戉戊戋戌戍戎戏成/我/戒戓戔戕或戗战戙戚戛戜戝戞戟戠戡戢戣戤戥戦戧戨戩截戫戬戭戮戯戰戱戲戳戴戵戶户戸戹戺戻戼戽戾房所扁扂扃扄扅扆扇扈扉扊手扌才扎扏扐扑扒打扔払扖扗托扙扚扛扜扝扞扟扠扡扢扣扤扥扦执扨扩扪扫扬扭扮扯扰扱扲扳扴扵扶扷扸批扺扻扼扽找承技抁抂抃抄抅抆抇抈抉把抋抌抍抎抏抐抑抒抓抔投抖抗折抙抚抛抜抝択抟抠抡抢抣护报抦抧抨抩抪披抬抭抮抯抰抱抲抳抴抵抶抷抸抹抺抻押抽抾抿拀拁拂拃拄担拆拇拈拉拊拋拌拍拎拏拐拑拒拓拔拕拖拗拘拙拚招拜拝拞拟拠拡拢拣拤拥拦拧拨择拪拫括拭拮拯拰拱拲拳拴拵拶拷拸拹拺拻拼拽拾拿 That's already 3 maps. And DP will try to render all of above chars, after that put our "我爱你" on the screen. What's worse, most of the cached chars won't be used, since many are uncommon. So it won't benefit as like western text. Then consider there are 8000+ words in Xonotic. So many chars, terrible, right? Relative constants (in code) are here. To fix? Not that easy. Decrease the map to e.g. 8*8 can solve the problem said before, not laggy anymore. But, the texture cache slots (1024 pieces by default) can easily be exhausted within minutes, after that many in-game textures will become gibberish. Memory cost is vastly increased, too. Increasing it will only result in segmentation fault: putting all chars in few maps isn't realistic either. So, the current way of DP to handle this is problematic. It shall be fixed by rewriting the entire mechanism, I feel. RE: A font-rendering performance problem (of upstream DarkPlaces) - NaitLee - 08-20-2022 I've reported it here. |