mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
35ce2fe74d
I spent a few hours in heap profilers. What I found was: * Inefficient use of heap when building up runs of `Action::Print(char)`. -> Solve by adding `Action::PrintString(String)` and accumulating utf8 bytes rather than u32 codepoints. * Inefficient use of heap when building Quad buffers: the default exponential growth of `Vec` tended to waste 40%-75% of the allocated capacity, and since we could keep ~1024 of these in cache, there's a lot of potential for waste. -> Solve by bounding the growth to 64 at a time. This has similar characteristics to exponential growth at the default 80x24 terminal size. May need to add a config option for this step size for users with very large terminals. * Lazy eviction from the LFU caches. The underlying cache advisor is somewhat probabilistic and has a minimum cache size of 256, making it difficult to maintain low heap utilization. -> Solve by replacing it with a very simple LFU algorithm. It doesn't seem to hurt much at the default terminal size with the default cache sizes. If we make the cache sizes smaller, its overhead is reduced. Some further experimentation is needed to adjust defaults, but this should help reduce heap usage. refs: https://github.com/wez/wezterm/issues/2626 |
||
---|---|---|
.. | ||
benches | ||
codegen | ||
data | ||
examples | ||
fuzz | ||
src | ||
Cargo.toml | ||
CHANGELOG.md | ||
LICENSE.md | ||
README.md |
Terminal Wizardry
This is a rust crate that provides a number of support functions for applications interested in either displaying data to a terminal or in building a terminal emulator.
It is currently in active development and subject to fairly wild sweeping changes.
Included functionality:
Surface
models a terminal display and its componentCell
s- Terminal attributes are aware of modern features such as True Color, Hyperlinks and will also support sixel and iterm style terminal graphics display.
Surface
s include a log ofChange
s and an API for consuming and applying deltas. This is a powerful building block for synchronizing screen instances.- Escape sequence parser decodes inscrutable escape sequences and gives them semantic meaning, making the code that uses them clearer. The decoded escapes can be re-encoded, allowing applications to start with the semantic meaning and emit the appropriate escape sequence without embedding obscure binary bytes.
Capabilities
allows probing for terminal capabilities that may not be included in the system terminfo database, and overriding them in an embedding application.Terminal
trait provides an abstraction over unix style ttys and Windows style console APIs.Change
s fromSurface
can be rendered toTerminal
s.Terminal
s allow decoding mouse and keyboard inputs in both blocking or non-blocking mode.Widget
trait allows composition of UI elements at a higher level.LineEditor
implements shell-like line editing functionality.
Windows Support
Termwiz understands how to work with both the legacy console APIs and the new PTY and virtual terminal features available in Windows 10, allowing for true color terminal applications on Windows 10.