Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering

https://news.ycombinator.com/rss Hits: 2
Summary

Drawing Text on Screen - What Could Be Simpler? So, this all started because I decided to learn Go. Polyglots say the best way to learn one is by doing something fun with it. Some watch movies, some read, some play with flashcards, others just jump into deep water and start talking with zero vocabulary. I figured that logic should work for programming languages too - so I picked a fun target project: writing a text-based file manager. Think old-school Norton Commander or Dos Navigator. My personal favorite is still FAR Manager - it's insanely productive, still actively developed, and honestly the main reason I haven't switched to Linux or macOS yet. Anyway, FAR Manager's code is in a language I don't speak, and writing plugins wouldn't get me where I want, so... I decided to just rewrite the whole thing. Easy, right? I know it's ridiculous, but that's fine - I like big impossible projects. Aim for the Moon, etc. The Plan I won't spoil the full idea (still might build it), but I disclose these two main modules: Input handling (keyboard, mouse) Output handling (drawing text on screen) Let's skip the boring input stuff - it works, after wrestling with all the quirks of Windows' console mode. Long story short: the “modern” VT (Virtual Terminal) mode that Windows adopted from Linux is slower output and dumber input than the old API. It doesn't even tell you when Shift is pressed, only when you actually type an uppercase letter with it. Add in a few more edge cases like Ctrl+Alt+Shift chaos, and you get the idea. I found workarounds, though, so keyboard input is mostly done. Now, the fun part. Output: Drawing Text How hard can it be to draw letters on a screen, right? There are several ways to do it in the Windows console: Old way: WriteConsoleOutputW - directly dump characters and color data to the screen. New way: WriteConsoleW - embed color codes in the text (the VT way), richer (e.g. bold, italic, underline) The new one is half as fast. On a modern mid-range PC, that'...

First seen: 2025-10-22 05:16

Last seen: 2025-10-22 06:17