mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-06 07:29:08 +00:00
terminal: configure scrollback compression
Idle compression was always enabled on supported renderer-backed surfaces and the default logical scrollback limit remained sized for fully resident history. Add a default-on scrollback-compression option and make renderer scheduling honor it across config reloads. Existing compressed pages remain encoded when the option is disabled, while reenabling it starts a fresh idle pass. Raise the default logical scrollback limit from 10 MB to 50 MB and document typical physical-memory savings, content-dependent behavior, and retained virtual address usage.
This commit is contained in:
@@ -1375,9 +1375,10 @@ input: RepeatableReadableIO = .{},
|
||||
///
|
||||
/// Scrollback is stored in memory and allocated lazily up to this limit, so
|
||||
/// setting a very large limit does not immediately consume that amount of
|
||||
/// memory. On supported systems, Ghostty attempts to compress fully historical
|
||||
/// pages which are not currently visible while the terminal is idle. This can
|
||||
/// reduce physical memory usage, depending on the contents of the scrollback.
|
||||
/// memory. On supported systems with scrollback compression enabled, Ghostty
|
||||
/// attempts to compress fully historical pages which are not currently visible
|
||||
/// while the terminal is idle. This can reduce physical memory usage, depending
|
||||
/// on the contents of the scrollback.
|
||||
///
|
||||
/// This limit always measures the uncompressed logical size of the terminal
|
||||
/// pages. Compression does not allow Ghostty to retain more history than the
|
||||
@@ -1390,7 +1391,31 @@ input: RepeatableReadableIO = .{},
|
||||
/// This is a future planned feature.
|
||||
///
|
||||
/// This can be changed at runtime but will only affect new terminal surfaces.
|
||||
@"scrollback-limit": usize = 10_000_000, // 10MB
|
||||
@"scrollback-limit": usize = 50_000_000, // 50MB
|
||||
|
||||
/// Whether to compress scrollback pages while the terminal is idle.
|
||||
///
|
||||
/// Ghostty does its best to only compress when idle and decompress
|
||||
/// as needed. This means that compression doesn't lower IO throughput.
|
||||
/// We recommend you keep it on.
|
||||
///
|
||||
/// The scrollback limit remains an uncompressed logical limit regardless of
|
||||
/// this setting, so disabling compression can increase physical memory usage
|
||||
/// but does not change how much history is retained.
|
||||
///
|
||||
/// Text-heavy terminal history generally compresses to approximately 10% to
|
||||
/// 30% of its uncompressed page memory, corresponding to a 70% to 90% reduction
|
||||
/// in physical memory for pages which are compressed. Compression savings are
|
||||
/// content-dependent.
|
||||
///
|
||||
/// Note that the way Ghostty works is that we compress and discard the
|
||||
/// physical/resident memory but we retain virtual mappings. You will not
|
||||
/// see a decrease in virtual memory usage, but you will see a decrease
|
||||
/// in physical/memory usage.
|
||||
///
|
||||
/// Changing this at runtime affects future compression work. Pages which are
|
||||
/// already compressed remain compressed until their contents are accessed.
|
||||
@"scrollback-compression": bool = true,
|
||||
|
||||
/// Control when the scrollbar is shown to scroll the scrollback buffer.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user