Initial Commit

This commit is contained in:
2025-08-30 16:07:19 +01:00
commit d86c15e30c
169 changed files with 121377 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../grapheme.h"
#include "../gen/word-test.h"
#include "util.h"
#define NUM_ITERATIONS 10000
struct break_benchmark_payload {
uint_least32_t *src;
size_t srclen;
uint_least32_t *dest;
size_t destlen;
};
void
libgrapheme(const void *payload)
{
const struct break_benchmark_payload *p = payload;
grapheme_to_uppercase(p->src, p->srclen, p->dest, p->destlen);
}
int
main(int argc, char *argv[])
{
struct break_benchmark_payload p;
double baseline = (double)NAN;
(void)argc;
if ((p.src = generate_cp_test_buffer(word_break_test,
LEN(word_break_test),
&(p.srclen))) == NULL) {
return 1;
}
if ((p.dest = calloc((p.destlen = 2 * p.srclen), sizeof(*(p.dest)))) == NULL) {
fprintf(stderr, "calloc: Out of memory\n");
}
printf("%s\n", argv[0]);
run_benchmark(libgrapheme, &p, "libgrapheme ", NULL, "codepoint",
&baseline, NUM_ITERATIONS, p.srclen - 1);
free(p.src);
free(p.dest);
return 0;
}