Hacker News new | ask | show | jobs
by anaganisk 1391 days ago
I’m just curious as to what GPU helps with for rendering plain html/markdown? What huge numbers is it crunching to render say a markdown file vs a 3D scene? Also browser doesn’t render MD right? All browser based implementations are done in JS or server side so what does it mean when its browserless?
2 comments

Thanks for the question. Markdown files are basically html files with syntax sugar, and a lot of markdown files directly use html. So to properly render most files you need a basic html renderer at minimum. Although yes, you don't need the other features of a browser but typically most markdown renderers are either web-based (GitHub) or electron based (VS Code).

GPU rendering helps for scaling images, rendering text and drawing other primitives efficiently. It frees up CPU time, and can redraw many times faster in scrolls and resizes. This is why most browsers use the GPU when most web content is 2D. GPU's don't really crunch huge numbers but instead utilise parallelisation.

Gotchu thanks for the reply!
Most graphical markdown renderers seems to convert markdown to html and then render that html using a browser engine. This includes basically any based on electron (vscode, atom, obsidian, roam) and a lot of others that do it via platform web views.

The point of the browser-less claim is that it converts the md to html the same way most existing engines do, but then does not use a browser engine to render it, instead using something faster and more purpose-built.

As for the GPU-thing I'm not sure, but for example terminals are sometimes written to take advantage of GPU's (kitty for example: https://sw.kovidgoyal.net/kitty/#design-philosophy ) so why not this?

Something like a simple markdown renderer has little reason to use the GPU. But a terminal emulator has absolutely no reason to use one. The bottlenecks there are system I/O and legacy API's, not the rendering performance.
The terminal statement is false. In fact I contributed an Alacritty feature that stopped rendering when the window was occluded that cut CPU usage from ~10% to ~0.4% when not visible. There's also a misconception on what GPU's are useful for. Being the graphics processing unit they are much faster for processing images and glyph graphics then the cpu.