summaryrefslogtreecommitdiff
path: root/benchmarks/term_write_bench.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/term_write_bench.c')
-rw-r--r--benchmarks/term_write_bench.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/benchmarks/term_write_bench.c b/benchmarks/term_write_bench.c
index 7649ed8..f393b4c 100644
--- a/benchmarks/term_write_bench.c
+++ b/benchmarks/term_write_bench.c
@@ -1,4 +1,4 @@
-#include "term/term.h"
+#include "wsap_vtcore/wsap_vtcore.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -20,13 +20,13 @@ static int cmp_double(const void *a, const void *b)
/* Timed sample: iterations full-buffer writes split at raw byte offsets, so a
* chunk smaller than len cuts UTF-8/CSI sequences mid-stream and exercises the
* parser's save-and-resume path, like real PTY reads do. */
-static double run_sample(struct term *t, const char *buf, size_t len,
+static double run_sample(struct wsap_vtcore *t, const char *buf, size_t len,
size_t chunk, int iterations, unsigned flags)
{
double start = now();
for (int i = 0; i < iterations; i++) {
for (size_t pos = 0; pos < len; pos += chunk)
- term_feed(t, buf + pos, len - pos < chunk ? len - pos : chunk, flags);
+ wsap_vtcore_feed(t, buf + pos, len - pos < chunk ? len - pos : chunk, flags);
}
return now() - start;
}
@@ -146,25 +146,25 @@ int main(int argc, char **argv)
}
for (int k = 0; k < nchunks; k++) {
size_t ck = chunks[k];
- const char *env_cols = getenv("TERM_COLS");
+ const char *env_cols = getenv("WSAP_VTCORE_COLS");
int cols_val = env_cols ? atoi(env_cols) : 120;
- struct term *t = term_new(&(struct term_options){
+ struct wsap_vtcore *t = wsap_vtcore_new(&(struct wsap_vtcore_options){
.size = { .x = cols_val, .y = 40 },
.scrollback = BENCH_SCROLLBACK,
});
if (!t) {
- fprintf(stderr, "term_new failed: TERM_COLS must be 0 to %d\n", TERM_MAX_COLS);
+ fprintf(stderr, "wsap_vtcore_new failed: WSAP_VTCORE_COLS must be 0 to %d\n", WSAP_VTCORE_MAX_COLS);
return EXIT_FAILURE;
}
/* manyline has bare LFs: each one also returns the cursor to
* column 0, as a tty with ONLCR does. */
- unsigned flags = !strcmp(cases[c].name, "manyline") ? TERM_FEED_ONLCR : 0;
+ unsigned flags = !strcmp(cases[c].name, "manyline") ? WSAP_VTCORE_FEED_ONLCR : 0;
if (!strncmp(cases[c].name, "margin-", 7)) {
const char setup[] = "\033[5;36r\033[36;1H";
- term_feed(t, setup, sizeof(setup) - 1, 0);
+ wsap_vtcore_feed(t, setup, sizeof(setup) - 1, 0);
} else if (strstr(cases[c].name, "-burst")) {
const char setup[] = "\033[40;1H";
- term_feed(t, setup, sizeof(setup) - 1, 0);
+ wsap_vtcore_feed(t, setup, sizeof(setup) - 1, 0);
}
/* Untimed warmup reaches steady-state scroll so rep 1 isn't a
* cold outlier. */
@@ -179,7 +179,7 @@ int main(int argc, char **argv)
printf("%-9s %6zu %10.2f %10.2f %10.2f %8.3f\n",
cases[c].name, ck, med, min, max,
samples[reps / 2] * 1e9 / bytes);
- term_free(t);
+ wsap_vtcore_free(t);
}
}
if (!matched) fprintf(stderr, "unknown benchmark case: %s\n", argv[1]);