summaryrefslogtreecommitdiff
path: root/benchmarks/hist_bench.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-15 13:04:01 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-15 13:04:01 +0300
commitdcebf9c7f954a55350b68d0ead1935612c4e2e05 (patch)
tree3eb3e9f6154c6760bcb89a565f8ddc8f8b66cb90 /benchmarks/hist_bench.c
parentbd8222e615134c3ec5e7a07b6b1fa97c9bd4a471 (diff)
Rename the library to wsap_vtcore
ncurses installs <term.h> and defines struct term. In a file that includes both headers, an ncurses TERMINAL * and this library's terminal are silently the same type. The name wsap_vtcore avoids the clash. The public header is now <wsap_vtcore/wsap_vtcore.h>. Every global symbol uses the wsap_vtcore_ prefix, every macro uses WSAP_VTCORE_, and the shared library is libwsap_vtcore.so.0. The default terminal name is now "wsap_vtcore". The ISA override variable is WSAP_VTCORE_ISA. No other behavior changes. The amalgamation writes wsap_vtcore.c and wsap_vtcore.h. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
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;
}