summaryrefslogtreecommitdiff
path: root/benchmarks/hist_bench.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-15 13:04:32 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-15 13:04:32 +0300
commitbdaedce69b17b654bd0060579dd9b9ff120009b5 (patch)
tree0e9cd8597652263a96c48ba678fb0b66e1fc131b /benchmarks/hist_bench.c
parentba75c8b0a1bba03ad92c53375432f122ddb4cb98 (diff)
parentdcebf9c7f954a55350b68d0ead1935612c4e2e05 (diff)
Merge branch 'wt/rename' into api-hardening
# Conflicts: # README.md
Diffstat (limited to 'benchmarks/hist_bench.c')
-rw-r--r--benchmarks/hist_bench.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/benchmarks/hist_bench.c b/benchmarks/hist_bench.c
index 2cf5608..bf3d1ca 100644
--- a/benchmarks/hist_bench.c
+++ b/benchmarks/hist_bench.c
@@ -14,7 +14,7 @@ static double now(void)
/* Rows shaped like the term-write-bench lines that scroll into history. */
static int make_row(const char *name, struct cell *row)
{
- struct cell d = { ' ', TERM_COLOR_FG, TERM_COLOR_BG, 0, 0 };
+ struct cell d = { ' ', WSAP_VTCORE_COLOR_FG, WSAP_VTCORE_COLOR_BG, 0, 0 };
int n = 0;
if (!strcmp(name, "ascii-row")) {
const char *s = "The quick brown fox jumps over the lazy dog. 0123456789";
@@ -37,15 +37,15 @@ static int make_row(const char *name, struct cell *row)
row[n] = d;
row[n].c = (uint8_t)s[n];
if (n < 3)
- row[n].fg = term_color_index(1);
+ row[n].fg = wsap_vtcore_color_index(1);
if (n > 3)
- row[n].fg = term_color_rgb(12, 34, 56);
+ row[n].fg = wsap_vtcore_color_rgb(12, 34, 56);
}
} else if (!strcmp(name, "fg-char-row")) {
for (; n < 120; n++) {
row[n] = d;
row[n].c = 'a' + (uint32_t)(n % 26);
- row[n].fg = term_color_rgb((uint8_t)n, (uint8_t)(n * 3), (uint8_t)(n * 7));
+ row[n].fg = wsap_vtcore_color_rgb((uint8_t)n, (uint8_t)(n * 3), (uint8_t)(n * 7));
}
}
return n;
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
{
int iterations = argc > 1 ? atoi(argv[1]) : 10000000;
struct hist h;
- if (!term_hist_init(&h, 10000, 8 * 1024 * 1024)) {
+ if (!wsap_vtcore_hist_init(&h, 10000, 8 * 1024 * 1024)) {
fprintf(stderr, "failed to initialize hist\n");
return EXIT_FAILURE;
}
@@ -63,31 +63,31 @@ int main(int argc, char **argv)
const char *line = "abcdefghijklmnopqrstuvwxyz\n";
int len = (int)strlen(line);
for (int i = 0; i < 10000; i++)
- term_hist_push_ascii(&h, line, len, NULL, false);
+ wsap_vtcore_hist_push_ascii(&h, line, len, NULL, false);
double t0 = now();
for (int i = 0; i < iterations; i++)
- term_hist_push_ascii(&h, line, len, NULL, false);
+ wsap_vtcore_hist_push_ascii(&h, line, len, NULL, false);
double elapsed = now() - t0;
printf("%-12s %6.2f ns/line %.2f GiB/s (%d B/line)\n", "ascii",
elapsed * 1e9 / iterations,
(double)iterations * len / (1024.0 * 1024.0 * 1024.0) / elapsed, len);
- term_hist_free(&h);
+ wsap_vtcore_hist_free(&h);
static const char *rows[] = { "ascii-row", "cjk-row", "colors-row", "fg-char-row" };
for (size_t k = 0; k < sizeof(rows) / sizeof(rows[0]); k++) {
struct cell row[128];
int n = make_row(rows[k], row);
int iters = iterations / 4;
- if (!term_hist_init(&h, 4096, 0))
+ if (!wsap_vtcore_hist_init(&h, 4096, 0))
return EXIT_FAILURE;
for (int i = 0; i < 10000; i++)
- term_hist_push_row(&h, row, n, false, NULL);
+ wsap_vtcore_hist_push_row(&h, row, n, false, NULL);
t0 = now();
for (int i = 0; i < iters; i++)
- term_hist_push_row(&h, row, n, false, NULL);
+ wsap_vtcore_hist_push_row(&h, row, n, false, NULL);
elapsed = now() - t0;
printf("%-12s %6.2f ns/row (%d cells)\n", rows[k], elapsed * 1e9 / iters, n);
- term_hist_free(&h);
+ wsap_vtcore_hist_free(&h);
}
return EXIT_SUCCESS;
}