mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +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 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE.md | ||
README.md |
wezterm-term
This crate provides the core of the virtual terminal emulator implementation used by wezterm. The home for this crate is in the wezterm repo and development is tracked at https://github.com/wez/wezterm/.
It is full featured, providing terminal escape sequence parsing, keyboard and mouse input encoding, a model for the screen cells including scrollback, sixel and iTerm2 image support, OSC 8 Hyperlinks and a wide range of terminal cell attributes.
This crate does not provide any kind of gui, nor does it directly
manage a PTY; you provide a std::io::Write
implementation that
could connect to a PTY, and supply bytes to the model via the
advance_bytes
method.
The entrypoint to the crate is the Terminal struct.
License: MIT