Repository navigation
🐛 fix(relaxng): keep one branch per closed tail - #2448
Conversation
Merging this PR will regress 2 benchmarks2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
6a850cf to
5a86974
Compare
A RELAX NG group whose tail is closed (removing any one item from a match keeps a match) and whose elements all share one content now drops the right side of its derivative when the left side covers the tail. Repeated blocks of optional elements kept one branch per place a later element could start, so the count grew with every block until it hit the choice cap and raised "too ambiguous" on valid documents. The tail's weak and uniform answers are computed on first use and kept on the node. Compiled nodes are settled before a schema is shared, so no validation writes to them. The routing reach cache keys on the names' code points instead of pointers into the document, so consecutive elements that spell the same name reuse the walk up they would otherwise repeat. Fixes tox-dev#2382
5a86974 to
26fd255
Compare
A block family whose tail elements each carry an attribute keeps one alternative per place: each element has its own content, so no single content covers the tail. The event work then passes its limit and validation raises "too ambiguous" at depths 5 and 7, the path the removed past-cap test covered.
The ladder test's rungs collapse under the closed-tail rule, so a list tail is entered with budget left and the budget-exhausted arm of the list derivative never runs. Rungs that hold an optional value are not weak, so the crossed places stay and the text run spends its budget before the list. The new test runs the list tails of the ladder table with those rungs, in both orders. The distinct-content halves case checks that elements with their own attributes decide the same as the shared ones.
A text derivative of a choice whose other branch needs two elements keeps the shared text node next to a group over both texts. Route adoption places that pair with the left side at the first text unit and the right side covering the whole halves, the overlap that the route placement check rejects. The new text-or-pair rows cover that arm, and the decision of the mirrored rows is unchanged.
A RELAX NG group whose tail is closed and whose elements share one content now drops the right side of its derivative when the left side covers the tail. Repeated blocks of optional elements kept one alternative per place a later element could start, so the alternatives grew with each block until they hit the choice cap and raised
too ambiguouson a valid document.The tail's
weakanduniformanswers are computed on first use and kept on the node. Compiled nodes are settled before a schema is shared, so validation never writes to them.The routing reach cache keys on the names' code points instead of pointers into the document, so elements that spell the same name share one walk up. Before, each element walked up again.
Work steps for the block family at T=100, 200, 400, 800 are 48,757, 96,783, 194,017 and 394,658 (exponent 1.01). Scaling the number of blocks from 8 to 128 at T=50 gives exponent 0.82. Both linearity tests in
tests/validate/test_relaxng.pypass.Fixes #2382