A full-featured web browser for the terminal using Chromium (CEF) with support for Sixel and Kitty graphics protocols. brow6el.dev

Faster rendering and no black flashes in kitty #20

Merged janantos.tngl.sh
targeting main from mendezr.tngl.sh/brow6el:perf-sixel
Merged opened by and assigned to janantos.tngl.sh
targeting main from mendezr.tngl.sh/brow6el:perf-sixel

Every repaint from CEF was encoded and sent to the terminal even when nothing had changed, and kitty frames were sent uncompressed. Five commits, each one usable on its own:

  1. Skip sixel frames identical to the one on screen. While a page is idle CEF keeps repainting; every one of those frames was byte for byte the previous one and cost about 100 ms of CPU and 650 KB of output.
  2. Disable smooth scrolling by default. Each scroll step was animated in about three frames that all had to be encoded. Adds disable-smooth-scrolling to the default cef_flags.conf and bumps the config version, so existing configs are migrated (with the usual .bak).
  3. Compress kitty frames and skip unchanged ones. A kitty frame was the whole page as raw RGB in base64, about 6.2 MB at 1600x980. zlib (o=z, the existing compress_zlib at Z_BEST_SPEED) brings it to about 22 KB in 6 ms.
  4. Do not blank the kitty image when clearing text. Forced redraws and closing dialogs used ED 2 and deleted the images before sending the next frame, so the screen was black until it arrived. The new frame is sent first and only the text is erased.
  5. Use a white background while pages load. The default windowless background is transparent, which showed as a black frame on every navigation.

Measured with the same harness before and after (1600x980, output sent to the terminal):

Case Before After
yahoo.fr, 15 s idle (sixel) 29 frames, 19.8 MB 0 frames, 0 MB
Wikipedia, 10 presses of j (sixel) 32 frames, 15.4 MB 10 frames, 4.9 MB
Typing 20 characters (kitty) 112 MB 0.8 MB
Navigating in kitty, black captures out of ~690 in 12 s 28 0

kitty while navigating: black frame before, page directly after

Tested in kitty 0.48.2 under Xvfb and in a real kitty, with sixel checked in a pseudo terminal and Konsole. Builds on current main and merges cleanly with the open pull requests.

Commits 0