aboutsummaryrefslogtreecommitdiff
path: root/src/params.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2025-01-09 06:27:15 +0000
committerGitHub <noreply@github.com>2025-01-09 06:27:15 +0000
commit7321a442a6fc0fc5b6d6ed7af364477d25e706fd (patch)
tree11ff2608e63a160b8b204b6f78ec3977f019d081 /src/params.rs
parent89c12df969145ffb5084d1122627d7292c2c638f (diff)
downloadr-alacritty-vte-7321a442a6fc0fc5b6d6ed7af364477d25e706fd.tar.gz
r-alacritty-vte-7321a442a6fc0fc5b6d6ed7af364477d25e706fd.tar.bz2
r-alacritty-vte-7321a442a6fc0fc5b6d6ed7af364477d25e706fd.zip
Switch parser to multi-byte processing
This patch overhauls the `Parser::advance` API to operate on byte slices instead of individual bytes, which allows for additional performance optimizations. VTE does not support C1 escapes and C0 escapes always start with an escape character. This makes it possible to simplify processing if a byte stream is determined to not contain any escapes. The `memchr` crate provides a battle-tested implementation for SIMD-accelerated byte searches, which is why this implementation makes use of it. VTE also only supports UTF8 characters in the ground state, which means that the new non-escape parsing path is able to rely completely on STD's `str::from_utf8` since `memchr` gives us the full length of the plain text character buffer. This allows us to completely remove `utf8parse` and all related code. We also make use of `memchr` in the synchronized escape handling in `ansi.rs`, since it relies heavily on scanning large amounts of text for the extension/termination escape sequences.
Diffstat (limited to 'src/params.rs')
-rw-r--r--src/params.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/params.rs b/src/params.rs
index 608c040..967befb 100644
--- a/src/params.rs
+++ b/src/params.rs
@@ -8,8 +8,9 @@ pub(crate) const MAX_PARAMS: usize = 32;
pub struct Params {
/// Number of subparameters for each parameter.
///
- /// For each entry in the `params` slice, this stores the length of the param as number of
- /// subparams at the same index as the param in the `params` slice.
+ /// For each entry in the `params` slice, this stores the length of the
+ /// param as number of subparams at the same index as the param in the
+ /// `params` slice.
///
/// At the subparam positions the length will always be `0`.
subparams: [u8; MAX_PARAMS],