paginate: mark the boundaries inside avoid boxes once, not per boundary per page - #144
Merged
Merged
Conversation
…ry per page allowed scanned every break-inside: avoid group for every candidate boundary on every page; a print stylesheet that sets break-inside: avoid on table rows (Wikipedia's does) turns a long table into thousands of groups, and a page of the countries table took 13.7 s to paginate, the Go article 3.9 s. blockedBoundaries now sweeps the groups once with a binary search each and a difference array, so a boundary's verdict is a lookup. Same breaks (the answer key and every synthetic case pass); 10 000 avoid rows paginate in the test's budget. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
allowedscanned everybreak-inside: avoidgroup for every candidate boundary on every page. Wikipedia's print stylesheet sets it on table rows, so the countries table paginated in 13.7 s and the Go article in 3.9 s (html2pdf's bench, fragmentation stage).blockedBoundariesnow sweeps the groups once (binary search + difference array); a boundary's verdict is a lookup. Same output — Chrome's answer key and every synthetic case pass; 10 000 avoid rows paginate within the test's budget. 100 % covered.🤖 Generated with Claude Code