Files
ghostty/src/terminal/compress.zig
Mitchell Hashimoto ebc3ffd222 terminal: add compressed page representation
The standalone LZ4 codec had no representation for terminal page
ownership or metadata, so PageList integration would otherwise need to
reconstruct every Page field independently.

Add compress.Page, which embeds the complete terminal Page while
retaining its original virtual mapping and owns only an exact-sized
encoded block. Compression is kept only when the encoded state is
strictly smaller, and scratch output is capped at that profitability
boundary so a future PageList caller can borrow a standard pool item.

Extend the page-compression benchmark with a store mode that measures
the encoded copy, allocation, bounded retention, and eviction path.
Nothing uses compression from PageList yet; this remains isolated
groundwork.
2026-07-09 09:47:11 -07:00

16 lines
538 B
Zig

//! Compression primitives used by the terminal.
//!
//! This namespace contains only the representation and codecs. Policy about
//! which pages to compress, when to decommit their resident memory, and when
//! to restore them belongs to `PageList`.
/// The raw LZ4 block codec used for terminal page memory.
pub const lz4 = @import("compress/lz4.zig");
/// A compressed terminal page which retains its original virtual mapping.
pub const Page = @import("compress/Page.zig");
test {
@import("std").testing.refAllDecls(@This());
}