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 {
21 libgrapheme(const void *payload)
23 const struct break_benchmark_payload *p = payload;
26 for (off = 0; off < p->buflen; ) {
27 off += grapheme_next_word_break(p->buf + off, p->buflen - off);
32 main(int argc, char *argv[])
34 struct break_benchmark_payload p;
35 double baseline = (double)NAN;
39 if ((p.buf = generate_cp_test_buffer(word_break_test,
41 &(p.buflen))) == NULL) {
45 printf("%s\n", argv[0]);
46 run_benchmark(libgrapheme, &p, "libgrapheme ", NULL, "codepoint",
47 &baseline, NUM_ITERATIONS, p.buflen - 1);