Skip to content

Q: performance benchmarks #21

@JCash

Description

@JCash

Hi!

I was wondering if you had any available benchmark numbers comparing with libraqm/harfbuzz?

In my current due diligence, for libraqm I'm using this example (by modifying their unit test to do the same):

static void DoTest(const char* name, raqm_t* rq, FT_Face face, const uint32_t* text, uint32_t len)
{
    raqm_clear_contents(rq);

    uint64_t tstart = GetTime();

    assert (raqm_set_text(rq, text, len));
    assert (raqm_set_freetype_face (rq, face));

    if (len < 600)
      raqm_set_par_direction (rq, RAQM_DIRECTION_LTR);
    else
      raqm_set_par_direction (rq, RAQM_DIRECTION_RTL);

    assert (raqm_layout (rq));

    size_t count;
    raqm_glyph_t *glyphs = raqm_get_glyphs (rq, &count);
    uint64_t tend = GetTime();

    // printf("glyph count: %zu\n", count);
    // for (size_t i = 0; i < count; i++)
    // {
    //     printf ("gid#%d off: (%d, %d) adv: (%d, %d) idx: %d\n",
    //             glyphs[i].index,
    //             glyphs[i].x_offset,
    //             glyphs[i].y_offset,
    //             glyphs[i].x_advance,
    //             glyphs[i].y_advance,
    //             glyphs[i].cluster);
    // }

    float t = (tend - tstart)/1000.0f;
    printf("RAQM: %s: Segmented %u codepoints into %zu glyphs in %.3fms (%.4f ms / glyph)\n", name, len, count, (tend - tstart)/1000.0f, t/len);
}

And I'm using your suggested SegmentText from the Readme.md.
(I've attached the test app in the zip)

The numbers I get are a fair bit slower than the raqm/harfbuzz test, so I'm curious if I'm perhaps missing something obvious in my setup?
Are the numbers what you'd expect compared to your benchmarks?

Thanks for any info!
/Mathias

  • The test text is the first paragraph of Lorem Ipsum, 309 codepoints
  • Results are milliseconds (and milliseconds/glyph)
  • Font is NotoSansArabic-Regulat.ttf
Image

EDIT:
By using NotoSans-Regulat.ttf the timing becomes a lot faster:

Segmented 309 codepoints into 309 glyphs in 0.293ms

Still, about 2x the time from raqm/harfbuzz.

The KB test app (contains both fonts for easy testing)

bench-kb.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions