Skip to content

Avoid doing unnecessary checks, when pre-rendering page layouts with "holes" (PR 14131 follow-up) #14225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

Sometimes I'll hopefully learn to optimize my code directly when writing it, rather than having to do multiple clean-up passes; sorry about the churn here!

For most page layouts there won't be any "holes" in the visible pages (or thumbnails), and in those cases it'd obviously be preferable not having to repeat any checks of already rendered pages.
Rather than only checking the "distance" between the first/last pages, we can instead compare the theoretical number of pages (between first/last) with the actually visible number of pages instead. This way, we're able to better detect the "holes"-case and can skip unnecessary parsing in the common case.

…"holes" (PR 14131 follow-up)

*Sometimes I'll hopefully learn to optimize my code directly when writing it, rather than having to do multiple clean-up passes; sorry about the churn here!*

For most page layouts there won't be any "holes" in the visible pages (or thumbnails), and in those cases it'd obviously be preferable not having to repeat any checks of already rendered pages.
Rather than only checking the "distance" between the first/last pages, we can instead compare the theoretical number of pages (between first/last) with the actually visible number of pages instead. This way, we're able to better detect the "holes"-case and can skip unnecessary parsing in the common case.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Nov 3, 2021

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/83ff3f6fea9ea0f/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Nov 3, 2021

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/83ff3f6fea9ea0f/output.txt

Total script time: 4.33 mins

Published

@timvandermeij timvandermeij merged commit 2ac6c93 into mozilla:master Nov 3, 2021
@timvandermeij
Copy link
Contributor

No worries; thanks for the follow-up!

@Snuffleupagus Snuffleupagus deleted the render-better-holes-check branch November 3, 2021 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants