This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux-11-parser-speedup
in repository terminology.

View the commit online.

commit 11f8992414c2401462ce5dd1a1c3feac6a8787b4
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 22 14:38:41 2026 -0600

    termptyesc: copy the CSI arguments in a loop of one test
    
    The scan of a CSI tested the end of the input, the byte class, the
    length limit, the control range and the buffer room for each byte it
    copied. The run of parameter and intermediate bytes now costs one range
    test and one bound each, and the old loop picks up at whatever stops it.
    
    tybench, cycles per input byte, 7 interleaved rounds: truecolor-cells
    -14.6% (15.52 -> 13.25), fill -2.8%, csi-motion -1.9%, insert -1.6%,
    insert-mode -1.5%, sgr -1.0%. Short arguments gain nothing. plain-ascii
    (+4.2%) and scroll (+2.0%) have no CSI to scan and their instructions
    per byte do not rise (47.6 -> 46.0, 123.2 -> 123.2), so it is layout.
---
 src/bin/termptyesc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index bf518d9c..d3ecd9d4 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -3821,6 +3821,17 @@ _handle_esc_csi_buf(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce,
    ty->seq_scanned = 0;
    cc = c + scanned;
    b = buf;
+   if (!scanned)
+     {
+        /* The arguments and intermediates, with no control among them, take
+         * one range test and one bound per codepoint. The loop below handles
+         * what stops this one: a control, the final byte, the end of the
+         * input, or the end of the buffer. */
+        const Eina_Unicode *args_end = c + MIN(ce - c, (long)buf_len - 1);
+
+        while ((cc < args_end) && ((unsigned int)*cc - ' ' <= '?' - ' '))
+          *b++ = *cc++;
+     }
    /* C0 controls are executed and are not part of the sequence, as in the
     * DEC parser: https://vt100.net/emu/dec_ansi_parser */
    while ((cc < ce) && (*cc <= '?') && (cc < ccmax))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to