Coverage format 2 now reads intersection results a word at a time, but
still inserted every selected glyph separately. Add an internal
word-at-a-time set insertion path and use it when the output sink is an
hb_set_t, preserving the generic per-glyph fallback for other sinks.
This removes another about 121M instructions from Noto Nastaliq
dependency construction. The compile-only run now takes about 226ms
task-clock / 229ms elapsed and 2.83B instructions, over 2,000x faster
than the original 7:44.77 run.
Dependency graphs match the original output for Noto Nastaliq, Noto
Sans Duployan, Gulzar, Iran Nastaliq, Noto COLRv1, Amiri, and Source
Serif Variable Roman.
Tested with: meson test -C build
Assisted-by: OpenAI Codex <codex@openai.com>
Set iteration does not always need the remaining item count. Defer the
population scan until len() is first requested, using unsigned accounting
to track advances without adding a branch to the iterator hot path.
This preserves fast length for iterator consumers that use it while
avoiding unnecessary population scans for the others. Noto Nastaliq
dependency construction is instruction-neutral because its existing set
iterators already encounter cached populations.
Tested with: meson test -C build
Assisted-by: OpenAI Codex <codex@openai.com>
Root and singleton active-glyph sets dominate dependency recursion memo
keys. Avoid copying and interning the root set, and encode singleton glyph
IDs directly in the key.
Add an internal singleton query that can recognize uncached sparse sets in
one pass while preserving the population cache.
On NotoNastaliqUrdu-Regular.ttf this reduces the compile-only dependency
run from about 3.18B to 3.05B instructions and from about 245ms to 238ms.
Dependency graphs match the previous output across the focused font
corpus.
Tested with: meson test -C build
Assisted-by: OpenAI Codex <codex@openai.com>
Fetch one nonempty 64-bit bitmap word at a time and consume its bits
locally in hb_set_t iterators. This avoids searching the sparse page
map once per codepoint while preserving inverted-set iteration and
bidirectional iterator behavior.
Mutating a set now explicitly invalidates its iterators.
Noto Nastaliq dependency construction is about 1-2% faster in an A/B
comparison, with 3.33B instructions reduced to 3.31B.
Tests: meson test -C build (272/272)
Tests: Noto dependency graph byte-identical to the pre-change oracle
Tests: full-Unicode subset output byte-identical for Noto Nastaliq,
Amiri, Source Serif Variable, and Noto COLRv1
Assisted-by: OpenAI Codex <codex@openai.com>
Set-to-set intersection currently only has a conservative may_intersect
helper because sets can be inverted. Callers that know their sets are
not inverted must otherwise reach through two implementation layers.
Add an exact intersects overload that handles all inversion combinations
without allocating. Use it for contextual dependency collection and add
unit coverage for normal, mixed, and inverted pairs.
Tested with the full Meson test suite (270/270 passed).
Assisted-by: OpenAI Codex <codex@openai.com>