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

git pushed a commit to branch master
in repository terminology.

View the commit online.

commit 6aa80fa4b5eb39aed513ae1e76edeab3fa11d519
Author: Cedric BAIL <[email protected]>
AuthorDate: Fri Nov 20 12:29:11 2026 -0600

    tybench: add a scrollback option and a 2000-line benchmark
    
    The test terminal keeps 50 lines of scrollback, while Terminology's
    default configuration keeps 2000. Rows saved into a larger ring are
    spread over more memory, and that cost is invisible at 50 lines.
    
    -s sets the scrollback of the benchmark terminal, and a second
    benchmark, pty-intake-scrollback-2000, runs the pty-intake corpora with
    the default size. On the corpora that push lines into the scrollback,
    2000 lines take more cycles than 50: long-lines 11%, plain-ascii 6%,
    scroll 5%, sgr 4% and unicode 3%. The others do not move.
    
    Measured with perf stat -e cycles:u, tybench -i 5, one process per run
    pinned to one CPU, the median of 5 interleaved runs.
---
 src/bin/tybench.c       | 19 +++++++++++++++----
 src/bin/tytest_common.c |  8 ++++++++
 src/bin/tytest_common.h |  2 ++
 tests/meson.build       | 21 +++++++++++++++------
 4 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/src/bin/tybench.c b/src/bin/tybench.c
index 6e065a54..ad6e02b7 100644
--- a/src/bin/tybench.c
+++ b/src/bin/tybench.c
@@ -122,9 +122,11 @@ _feed_pass(const Corpus *c, int chunk)
  * a hyperlink keeps its link table, and with it the slower paths that keep
  * the links counted. */
 static void
-_reset_terminal(void)
+_reset_terminal(size_t scrollback)
 {
    tytest_common_reset();
+   if (scrollback)
+     tytest_common_scrollback_set(scrollback);
 }
 
 static void
@@ -136,9 +138,11 @@ _usage(const char *argv0)
            "  -i, --iterations=N  timed passes over each corpus (default %d)\n"
            "  -w, --warmup=N      untimed passes before timing (default %d)\n"
            "  -c, --chunk=N       bytes per simulated read() (default %d)\n"
+           "  -s, --scrollback=N  lines of scrollback (default %d)\n"
            "  -t, --tsv           tab-separated output for scripting\n"
            "  -h, --help          this message\n",
-           argv0, DEFAULT_ITERATIONS, DEFAULT_WARMUP, DEFAULT_CHUNK);
+           argv0, DEFAULT_ITERATIONS, DEFAULT_WARMUP, DEFAULT_CHUNK,
+           TY_BACKSIZE);
 }
 
 static int
@@ -158,6 +162,7 @@ main(int argc, char **argv)
    int iterations = DEFAULT_ITERATIONS;
    int warmup = DEFAULT_WARMUP;
    int chunk = DEFAULT_CHUNK;
+   int scrollback = 0;
    Eina_Bool tsv = EINA_FALSE;
    int i, ncorpus = 0;
    Corpus *corpus;
@@ -183,12 +188,16 @@ main(int argc, char **argv)
           warmup = atoi(argv[++i]);
         else if (!strcmp(a, "-c") && i + 1 < argc)
           chunk = atoi(argv[++i]);
+        else if (!strcmp(a, "-s") && i + 1 < argc)
+          scrollback = atoi(argv[++i]);
         else if (_int_opt(a, "--iterations", &iterations))
           continue;
         else if (_int_opt(a, "--warmup", &warmup))
           continue;
         else if (_int_opt(a, "--chunk", &chunk))
           continue;
+        else if (_int_opt(a, "--scrollback", &scrollback))
+          continue;
         else if (a[0] == '-')
           {
              fprintf(stderr, "tybench: unknown option %s\n", a);
@@ -216,6 +225,7 @@ main(int argc, char **argv)
    if (iterations < 1) iterations = 1;
    if (warmup < 0) warmup = 0;
    if (chunk < 1) chunk = 1;
+   if (scrollback < 0) scrollback = 0;
 
    eina_init();
    _log_domain = eina_log_domain_register("tybench", NULL);
@@ -229,7 +239,8 @@ main(int argc, char **argv)
 
    if (!tsv)
      {
-        printf("chunk=%d iterations=%d warmup=%d\n\n", chunk, iterations, warmup);
+        printf("chunk=%d iterations=%d warmup=%d scrollback=%d\n\n", chunk,
+               iterations, warmup, scrollback ? scrollback : TY_BACKSIZE);
         printf("%-16s %10s %8s %10s %10s\n",
                "corpus", "bytes", "MB/s", "ns/byte", "best MB/s");
         printf("%-16s %10s %8s %10s %10s\n",
@@ -242,7 +253,7 @@ main(int argc, char **argv)
         double total, best_pass = 0.0, mbs, best_mbs;
         int pass;
 
-        _reset_terminal();
+        _reset_terminal(scrollback);
         for (pass = 0; pass < warmup; pass++)
           _feed_pass(&corpus[i], chunk);
 
diff --git a/src/bin/tytest_common.c b/src/bin/tytest_common.c
index 15de0a6c..2566352e 100644
--- a/src/bin/tytest_common.c
+++ b/src/bin/tytest_common.c
@@ -1097,6 +1097,14 @@ tytest_common_reset(void)
    tytest_termio_resize(TY_W, TY_H);
 }
 
+void
+tytest_common_scrollback_set(size_t lines)
+{
+   /* through none: a resized scrollback keeps the rows it holds */
+   termpty_backlog_size_set(&_ty, 0);
+   termpty_backlog_size_set(&_ty, lines);
+}
+
 void
 tytest_common_shutdown(void)
 {
diff --git a/src/bin/tytest_common.h b/src/bin/tytest_common.h
index 23f924a9..5ae3dfa3 100644
--- a/src/bin/tytest_common.h
+++ b/src/bin/tytest_common.h
@@ -24,6 +24,8 @@ void tytest_common_reset(void);
 void tytest_common_set_chunk(int chunk);
 void tytest_common_init(void);
 void tytest_common_shutdown(void);
+/* Give the shared terminal a new, empty scrollback of lines. */
+void tytest_common_scrollback_set(size_t lines);
 void tytest_common_set_fd(int fd);
 #if defined(BINARY_TYTEST)
 const char *tytest_cursor_shape_get(void);
diff --git a/tests/meson.build b/tests/meson.build
index 1d4029c2..12fab8a0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -105,11 +105,7 @@ if benchmarks
                 '@OUTDIR@'],
       build_by_default: false)
 
-  # Run with `meson test --benchmark`.
-  benchmark('pty-intake',
-            tybench,
-            args: ['-i', '5',
-                   bench_corpus_dir / 'fill',
+  bench_corpora = [bench_corpus_dir / 'fill',
                    bench_corpus_dir / 'hyperlink',
                    bench_corpus_dir / 'insert',
                    bench_corpus_dir / 'insert-mode',
@@ -119,7 +115,20 @@ if benchmarks
                    bench_corpus_dir / 'scroll',
                    bench_corpus_dir / 'scroll-region',
                    bench_corpus_dir / 'sgr',
-                   bench_corpus_dir / 'unicode'],
+                   bench_corpus_dir / 'unicode']
+
+  # Run with `meson test --benchmark`.
+  benchmark('pty-intake',
+            tybench,
+            args: ['-i', '5'] + bench_corpora,
+            depends: bench_corpus,
+            timeout: 600)
+
+  # With the default scrollback of the configuration, rather than the 50
+  # lines of the test terminal.
+  benchmark('pty-intake-scrollback-2000',
+            tybench,
+            args: ['-i', '5', '-s', '2000'] + bench_corpora,
             depends: bench_corpus,
             timeout: 600)
 

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

Reply via email to