Hasty Briefsbeta

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

8 days ago
  • #programming
  • #Windows
  • #performance
  • The author decided to learn Go by working on a fun project: rewriting a text-based file manager inspired by FAR Manager.
  • The project focuses on two main modules: input handling (keyboard, mouse) and output handling (drawing text on screen).
  • Input handling in Windows' console mode was challenging due to quirks in the 'modern' VT mode, but workarounds were found.
  • For output, the author compared several methods to draw text on the screen, including old and new console APIs, GDI, DirectX, and Vulkan.
  • Benchmark results showed that GPU rendering (DirectX and Vulkan) performed better in realistic conditions (white on black text) but struggled in stress tests (random colors).
  • Caching characters as textures provided a speed boost in stress tests but slowed performance in normal use cases due to lost flexibility.
  • The optimal solution was DirectX with direct text drawing, balancing speed and flexibility while leaving room for future cross-platform options like Vulkan.
  • The author concluded that drawing text on screen is more complex than it seems, with most internet forums misunderstanding the real bottlenecks.