1
1
mirror of https://github.com/wez/wezterm.git synced 2024-10-27 16:19:25 +03:00
wezterm/termwiz
Wez Furlong e188406dfc make semantic zones more cacheable
This commit decomposes the main get_semantic_zones method into two
parts:

* A per-line portion, where the line ranges are cached (invalidated on
  change)
* The overall screen portion, where the line ranges are merged

This changes the overall complexity of computing zones from

   O(width * scrollback-height)

To an incremental:

   O((width * number of changed lines since last query) + scrollback-height)

You can see some samples of elapsed time below; those show the times for
running both the old and the new implementation on the same data.  The
number of lines/zones in the scrollback increases with each call and you
can see that the new implementation is a bit faster anyway at low
volumes but is significantly faster as the number of lines/zones
increases, because the amount of work is reduced.

```
get_semantic_zones: 71.708µs
get_semantic_zones_new: 59.041µs
get_semantic_zones: 71.166µs
get_semantic_zones_new: 9.166µs
get_semantic_zones: 44.291µs
get_semantic_zones_new: 4.208µs
get_semantic_zones: 69.791µs
get_semantic_zones_new: 10.291µs
get_semantic_zones: 59.375µs
get_semantic_zones_new: 7.958µs
get_semantic_zones: 52.5µs
get_semantic_zones_new: 4.5µs
get_semantic_zones: 91.791µs
get_semantic_zones_new: 20.916µs
get_semantic_zones: 229.916µs
get_semantic_zones_new: 109.208µs
get_semantic_zones: 224.125µs
get_semantic_zones_new: 15.208µs
get_semantic_zones: 291.791µs
get_semantic_zones_new: 11.833µs
get_semantic_zones: 238.875µs
get_semantic_zones_new: 12.625µs
get_semantic_zones: 468.458µs
get_semantic_zones_new: 126.583µs
get_semantic_zones: 460.5µs
get_semantic_zones_new: 25.666µs
get_semantic_zones: 358.291µs
get_semantic_zones_new: 19.541µs
get_semantic_zones: 436.833µs
get_semantic_zones_new: 17.875µs
get_semantic_zones: 313.166µs
get_semantic_zones_new: 15.25µs
get_semantic_zones: 333.958µs
get_semantic_zones_new: 16.541µs
get_semantic_zones: 364.666µs
get_semantic_zones_new: 14.041µs
 ```
2022-01-17 22:00:38 -07:00
..
data Respect emoji-variation-sequences.txt 2021-11-25 14:37:24 -07:00
examples termwiz: Windows: force CP_UTF8, fix alt-screen and examples 2021-12-22 12:54:57 -07:00
src make semantic zones more cacheable 2022-01-17 22:00:38 -07:00
Cargo.toml move tmux-cc crate to be module inside termwiz 2022-01-17 13:43:35 -07:00
LICENSE.md restructure termwiz tree prior to merging into wezterm repo 2018-08-05 07:55:30 -07:00
README.md termwiz: cut 0.9.0 release 2020-05-17 12:05:46 -07:00

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 component Cells
  • Terminal attributes are aware of modern features such as True Color, Hyperlinks and will also support sixel and iterm style terminal graphics display.
  • Surfaces include a log of Changes 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. Changes from Surface can be rendered to Terminals. Terminals 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.

Documentation

https://docs.rs/termwiz