[CoverageFormat2] Remove hand-written loop
While on a fuzzer-found test case (added) that loop was faster, on real fonts, including NotoNastaliq in our benchmark, it was actually slower, which intuitively I would have expected. Still no idea why on that fuzzer case it's faster though. :(
This commit is contained in:
parent
bbb4db90dd
commit
9eab3ac72d
|
@ -142,37 +142,12 @@ struct CoverageFormat2_4
|
||||||
hb_requires (hb_is_sink_of (IterableOut, hb_codepoint_t))>
|
hb_requires (hb_is_sink_of (IterableOut, hb_codepoint_t))>
|
||||||
void intersect_set (const hb_set_t &glyphs, IterableOut &intersect_glyphs) const
|
void intersect_set (const hb_set_t &glyphs, IterableOut &intersect_glyphs) const
|
||||||
{
|
{
|
||||||
/* Why the second branch is >2x faster I have no idea, but it seems to be. */
|
for (const auto& range : rangeRecord)
|
||||||
if (0)
|
|
||||||
{
|
{
|
||||||
for (const auto& range : rangeRecord)
|
hb_codepoint_t last = range.last;
|
||||||
{
|
for (hb_codepoint_t g = range.first - 1;
|
||||||
hb_codepoint_t last = range.last;
|
glyphs.next (&g) && g <= last;)
|
||||||
for (hb_codepoint_t g = range.first - 1;
|
intersect_glyphs << g;
|
||||||
glyphs.next (&g) && g <= last;)
|
|
||||||
intersect_glyphs << g;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
iter_t c_iter;
|
|
||||||
c_iter.init (*this);
|
|
||||||
auto s_iter = hb_iter (glyphs);
|
|
||||||
while (c_iter.__more__ () && s_iter)
|
|
||||||
{
|
|
||||||
hb_codepoint_t cv = c_iter.get_glyph ();
|
|
||||||
hb_codepoint_t sv = *s_iter;
|
|
||||||
if (cv == sv)
|
|
||||||
{
|
|
||||||
intersect_glyphs << cv;
|
|
||||||
c_iter.__next__ ();
|
|
||||||
s_iter++;
|
|
||||||
}
|
|
||||||
else if (cv < sv)
|
|
||||||
c_iter.__next__ ();
|
|
||||||
else
|
|
||||||
s_iter++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue