summaryrefslogtreecommitdiff
path: root/benchmarks/term_resize_bench.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/term_resize_bench.c')
-rw-r--r--benchmarks/term_resize_bench.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/benchmarks/term_resize_bench.c b/benchmarks/term_resize_bench.c
index 08634d1..2899dae 100644
--- a/benchmarks/term_resize_bench.c
+++ b/benchmarks/term_resize_bench.c
@@ -1,4 +1,4 @@
-#include "term/term.h"
+#include "wsap_vtcore/wsap_vtcore.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -34,7 +34,7 @@ static int cmp_double(const void *a, const void *b)
enum content { SHORT, WRAPPED, MIXED, PROMPT, WIDE, CONTENT_COUNT };
static const char *content_names[] = {"short", "wrapped", "mixed", "prompt", "wide"};
-static void emit_line(struct term *t, enum content kind, int n, int cols)
+static void emit_line(struct wsap_vtcore *t, enum content kind, int n, int cols)
{
char line[4096];
int len = 0;
@@ -74,12 +74,12 @@ static void emit_line(struct term *t, enum content kind, int n, int cols)
break;
}
(void)cols;
- term_feed(t, line, (size_t)len, 0);
+ wsap_vtcore_feed(t, line, (size_t)len, 0);
}
-static struct term *make_filled(enum content kind, int cols, int rows, int history)
+static struct wsap_vtcore *make_filled(enum content kind, int cols, int rows, int history)
{
- struct term *t = term_new(&(struct term_options){
+ struct wsap_vtcore *t = wsap_vtcore_new(&(struct wsap_vtcore_options){
.size = { .x = cols, .y = rows },
.scrollback = history,
});
@@ -89,10 +89,10 @@ static struct term *make_filled(enum content kind, int cols, int rows, int histo
return t;
}
-static void resize(struct term *t, int cols, int rows)
+static void resize(struct wsap_vtcore *t, int cols, int rows)
{
- if (!term_resize(t, (struct term_vector2i){ .x = cols, .y = rows })) {
- fprintf(stderr, "term_resize failed: out of memory\n");
+ if (!wsap_vtcore_resize(t, (struct wsap_vtcore_vector2i){ .x = cols, .y = rows })) {
+ fprintf(stderr, "wsap_vtcore_resize failed: out of memory\n");
exit(EXIT_FAILURE);
}
}
@@ -113,12 +113,12 @@ static double bench_pair(enum content kind, int from_cols, int to_cols, int rows
{
double worst = 0;
for (int i = 0; i < samples; i++) {
- struct term *t = make_filled(kind, from_cols, rows, history);
+ struct wsap_vtcore *t = make_filled(kind, from_cols, rows, history);
if (!t) exit(EXIT_FAILURE);
double start = now();
resize(t, to_cols, rows);
double ms = (now() - start) * 1e3;
- term_free(t);
+ wsap_vtcore_free(t);
out[i] = ms;
if (ms > worst) worst = ms;
}
@@ -132,14 +132,14 @@ static int bench_drag(enum content kind, int from_cols, int to_cols, int rows,
int n = 0;
int step = from_cols > to_cols ? -1 : 1;
for (int p = 0; p < passes; p++) {
- struct term *t = make_filled(kind, from_cols, rows, history);
+ struct wsap_vtcore *t = make_filled(kind, from_cols, rows, history);
if (!t) exit(EXIT_FAILURE);
for (int c = from_cols + step; c != to_cols + step; c += step) {
double start = now();
resize(t, c, rows);
out[n++] = (now() - start) * 1e3;
}
- term_free(t);
+ wsap_vtcore_free(t);
}
return n;
}