Atlas performance #12811
Replies: 3 comments 2 replies
-
I believe @lhecker has been preparing a blog post on the topic for quite some time now, so he's probably interested in this discussion. We've still got plenty of enhancements in the works, so stay tuned! |
Beta Was this translation helpful? Give feedback.
-
If Direct2D/D2D (which is what the old renderer is based on) was actually slow and we could just write something much faster within a few months, it'd be a pretty poor outlook for Microsoft's engineering. 😅 D2D implements text rendering using a built-in glyph/texture atlas to cache rasterized glyphs and a lookup-table/LUT for coloring those glyphs. I'm not sure about the size limit for the glyph atlas, but the LUT has a limit of about 20 colors. This works fine for almost all situations (even this website, GitHub, doesn't use >20 text foreground colors), but if you exceed this, an excessive amount of time is spent updating the LUT, causing a steep drop in performance. Again, this isn't much of a problem for Websites and other UI applications, since the text will be mostly static, but for Terminals we routinely see applications coloring their entire background in ░▒▓█ block characters, animating text at >60 FPS, etc., where this starts to be an actual problem. Our new renderer is specifically written for modern hardware and for monospace text only, which means it can both drastically simplify the implementation, assuming that each character is drawn in a fixed grid (unlike with regular, proportional fonts, D2D has to support) and take advantage of today's GPUs with their performant calculations and relatively large memories. The end result is that you should find that the newer atlas engine will draw less power on modern GPUs like your RTX 3080 (specifically DirectX 11 and newer GPUs). On slower, portable hardware, you should see an actual improvement in throughput. On my laptop for instance I see an improvement of about 15%. Basically you can't notice this performance improvement, because your PC is simply too fast. 😄 But as I said initially, the most noticeable improvement right now can already be observed with highly colored and/or complex text. I recorded a video of such a TUI application a while ago: NL6uL25ugufkPPpt.mp4 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
So, new experimental text renderer - great! I also read the release note from @cinnamon-msft that performance differences were likely to be negligible at the moment, - noted. Decided to test it out with a simple use case anyway.
TL;DR - no meaningful performance change at all, which is not unexpected, but it led me to an interesting observation about shells and WSL.
My setup: Core i9-10750K, 64GB RAM, 2TB Samsung 970 EVO Plus SSD, RTX 3080 GPU, on Windows 22H2, build 22581.200.
Test: Create a 10MB text file in my Windows home folder. Replicate that file into the home folders of two Linux WSL distros. Time how long it takes to dump that text file to the console in Powershell 7.2.2, Ubuntu 21.10, Fedora 36, and CMD.
Measurement: Not terribly precise, but at least internally consistent. Powershell, using
oh-my-posh
with execution time wired into the prompt. Fedora and Ubuntu, usingtime
command inzsh
. CMD, using%time%
bookends and some calculation.With Atlas off (all times in seconds):
With Atlas on (all times in seconds):
Summary: Atlas hasn't yet changed performance, which is predicted. It also seems pretty stable this far, which is a win. The real takeaways for me were 1) how slow Powershell is to this day in console performance, and 2) how fast Linux consoles can be in WSL2!
Look forward to seeing more in this area!
Beta Was this translation helpful? Give feedback.
All reactions