A guard-safe test for the Extended_Pictographic property.
The property is consulted once per codepoint by the grapheme break rules (GB11) and the line break rules (LB30b), so it sits in the hot path of both.
Testing its 156 ranges as a flat chain of or comparisons costs all 156 for
every character that is not pictographic, because or short-circuits on
true rather than on false, and in ordinary text almost no character is
pictographic. The first range begins at U+00A9, which makes Latin text the
worst case rather than the best one.
The ranges are therefore compiled into a balanced binary tree of comparisons instead. Each node tests one range and descends into one side:
(codepoint < from and <left>) or
(codepoint > to and <right>) or
(codepoint >= from and codepoint <= to)and and or are short-circuiting, so exactly one subtree is evaluated and
the depth is log2(156), about 8 nodes. The whole expression is built from
comparisons and boolean operators only, so it remains valid in a guard.