Skip to content
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

Reduce the number of redundant updatetextlayermatches events dispatched when calculating matches in PDFFindController #10201

Merged
merged 1 commit into from
Oct 31, 2018

Conversation

Snuffleupagus
Copy link
Collaborator

Currently PDFFindController._calculateMatch is (indirectly) dispatching an updatetextlayermatches event for every single page of the document. For short documents, such as the tracemonkey file, this probably doesn't matter too much, but for documents with a couple of thousand pages it seems unfortunate.

It shouldn't be necessary, in general, to dispatch updatetextlayermatches events here, since that's already being taken care of in PDFFindController._updateMatch which is always called when a match has been found.
However, when highlightAll is set we still need to ensure that pages which finished rendered before searching begun are updated correctly.

…ched when calculating matches in `PDFFindController`

Currently `PDFFindController._calculateMatch` is (indirectly) dispatching an `updatetextlayermatches` event for every *single* page of the document. For short documents, such as the `tracemonkey` file, this probably doesn't matter too much, but for documents with a couple of thousand pages it seems unfortunate.

It shouldn't be necessary, in general, to dispatch `updatetextlayermatches` events here, since that's already being taken care of in `PDFFindController._updateMatch` which is always called when a match has been found.
However, when `highlightAll` is set we still need to ensure that pages which finished rendered *before* searching begun are updated correctly.
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/6664fadf086a53b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/6664fadf086a53b/output.txt

Total script time: 3.03 mins

Published

@timvandermeij timvandermeij merged commit bb5f261 into mozilla:master Oct 31, 2018
@timvandermeij
Copy link
Contributor

Good optimization; thank you!

@Snuffleupagus Snuffleupagus deleted the find-less-updatePage branch October 31, 2018 22:32
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