[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
|
@ -141,9 +141,6 @@ struct CoverageFormat2_4
|
|||
template <typename IterableOut,
|
||||
hb_requires (hb_is_sink_of (IterableOut, hb_codepoint_t))>
|
||||
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. */
|
||||
if (0)
|
||||
{
|
||||
for (const auto& range : rangeRecord)
|
||||
{
|
||||
|
@ -153,28 +150,6 @@ struct CoverageFormat2_4
|
|||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename set_t>
|
||||
bool collect_coverage (set_t *glyphs) const
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue