Shitty Terminal Emulator: High-Performance C++23 Terminal

Overview

Shitty is a high-performance terminal emulator designed for low latency, fast startup, and predictable resource utilization. It achieves superior throughput by keeping terminal state on the CPU and utilizing native compute backends for rendering: Vulkan on Linux and Metal on macOS.

Performance Benchmarks

In standardized tests using an Apple-silicon MacBook (Menlo 12pt, 80x24 grid, 500 lines of scrollback), Shitty demonstrates leading throughput across different data types:

Printable ASCII Throughput

When processing 100MB of printable ASCII data, Shitty achieved the fastest wall time and throughput among compared terminals:

Terminal Wall Time User Time Throughput
Shitty 0.81s 0.50s ~118 MiB/s
Alacritty 0.17.0 0.96s 0.78s ~99 MiB/s
Kitty 0.48.2 1.28s 0.95s ~75 MiB/s
Ghostty 1.3.1 1.49s 1.60s ~64 MiB/s

Random Byte Throughput (Invalid UTF-8)

Shitty maintains stability and performance even when parsing random bytes, which represents the parser's worst-case scenario:

Terminal Wall Time User Time Throughput
Shitty 1.88s 1.79s ~51 MiB/s
Alacritty 0.17.0 3.07s 2.92s ~31 MiB/s
Ghostty 1.3.1 4.63s ~7.0s ~21 MiB/s
Kitty 0.48.2 N/A N/A N/A

Technical Architecture

Parser Implementation

Shitty utilizes Ragel to generate its terminal state machine. This approach creates a large Deterministic Finite Automaton (DFA) with actions for every possible terminal state, ensuring the parser is total and indestructible. This design allows the terminal to handle cat /dev/urandom as a benchmark rather than a cause for crashes.

Rendering and Graphics

Rendering is damage-driven and leverages native GPU compute backends to ensure flicker-free resizing and high efficiency:

  • macOS: Uses Metal, CoreText, Cocoa, and IOSurface.
  • Linux: Uses Vulkan and Wayland.
  • Glyph Management: Implements lazy glyph rasterization and a persistent GPU glyph cache.

Unicode and Text Handling

The terminal treats cells as grapheme clusters rather than individual codepoints. This ensures correct rendering of:

  • Emoji sequences
  • Variation selectors
  • Combining marks
  • Wide CJK characters

Feature Set

Shitty provides a comprehensive set of terminal capabilities:

  • Protocols: Supports VT52 through VT5xx controls, xterm extensions, and multiple mouse protocols (X10, VT200, UTF-8, SGR, SGR-pixel, urxvt).
  • Keyboard Support: Supports legacy, modifyOtherKeys, and Kitty keyboard protocols.
  • Visuals: Supports 16-colour, 256-colour, and 24-bit colour, including extended underline styles.
  • Security: Locked down by default; applications cannot read selections or drive the host window without explicit permission.
  • Self-Containment: The binary is small and embeds fonts, allowing it to start on systems with no installed fonts.

Build and Requirements

Shitty is written in C++23 and requires Clang. On macOS, LLVM from Homebrew is required as the system clang does not support the necessary -std=c++26 for the bundled libstd.

Key Dependencies:

  • Python 3, Ragel 6, and glslangValidator
  • utf8proc 2.9+
  • librsvg (for build-time icon rendering)
  • Linux-specific: FreeType, HarfBuzz, Wayland client headers, xkbcommon, and Vulkan headers/loader.

Lineage and Licensing

Shitty is a hard fork and complete rewrite of Zutty, originally created by Tom Szilagyi. While it retains the Zutty lineage, it replaces the architecture, renderer, and testing strategy.

Regarding licensing, the project is transitioning from a GPL baseline to an MIT-only codebase. Currently, new contributions are dual-licensed under GPLv3-or-later and MIT, though the combined work remains subject to the GPL due to imported material.

Community Insights and Counterpoints

Discussion among users and developers highlights several points of contention and interest:

  • Naming: The project's name has sparked debate, with some praising the humor and others arguing it is unprofessional and may hinder corporate adoption.
  • Performance Context: Some users question the practical utility of extreme throughput benchmarks, noting that standard terminals (like Terminal.app) are sufficient for most workflows. One user claimed that urxvt under X11 still outperforms Shitty in ASCII throughput (~122 MiB/s).
  • Competitive Benchmarking: Mitchell Hashimoto (creator of Ghostty) noted that Ghostty's IO throughput has improved significantly since version 1.3.1 and suggested re-benchmarking against the main branch.
  • Missing Features: Critics noted the absence of bidirectional text layout and inline graphics protocols (such as sixel) as significant gaps compared to other modern terminals.

Sources