1 /* See LICENSE file for copyright and license details. */
9 #include "../grapheme.h"
10 #include "../gen/word-test.h"
13 #define NUM_ITERATIONS 10000
15 struct break_benchmark_payload {
23 libgrapheme(const void *payload)
25 const struct break_benchmark_payload *p = payload;
27 grapheme_to_uppercase(p->src, p->srclen, p->dest, p->destlen);
31 main(int argc, char *argv[])
33 struct break_benchmark_payload p;
34 double baseline = (double)NAN;
38 if ((p.src = generate_cp_test_buffer(word_break_test,
40 &(p.srclen))) == NULL) {
43 if ((p.dest = calloc((p.destlen = 2 * p.srclen), sizeof(*(p.dest)))) == NULL) {
44 fprintf(stderr, "calloc: Out of memory\n");
47 printf("%s\n", argv[0]);
48 run_benchmark(libgrapheme, &p, "libgrapheme ", NULL, "codepoint",
49 &baseline, NUM_ITERATIONS, p.srclen - 1);