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

Make the find helper function, in src/core/document.js, more efficient by using peekBytes rather reading the stream one byte at a time #10947

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

Please note: A a similar change was attempted in PR #5005, but it was subsequently backed out in PR #5069.

Unfortunately I don't think anyone ever tried to debug exactly why it didn't work, since it ought to have worked, and having re-tested this now I'm not able to reproduce the problem any more. However, given just how inefficient the current code is, with thousands of strictly unnecessary function calls for each find invocation, I'd really like to try fixing this again.

…cient by using `peekBytes` rather reading the stream one byte at a time

*Please note:* A a similar change was attempted in PR 5005, but it was subsequently backed out in PR 5069.

Unfortunately I don't think anyone ever tried to debug *exactly* why it didn't work, since it ought to have worked, and having re-tested this now I'm not able to reproduce the problem any more. However, given just how inefficient the current code is, with thousands of strictly unnecessary function calls for each `find` invocation, I'd really like to try fixing this again.
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2019

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/c5b8642127876c6/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2019

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/bf0551b6c53f8ff/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2019

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/c5b8642127876c6/output.txt

Total script time: 17.53 mins

  • Font tests: Passed
  • Unit tests: FAILED
  • Regression tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2019

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/bf0551b6c53f8ff/output.txt

Total script time: 25.96 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2019

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/51aed89a4df7d80/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jul 6, 2019

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/51aed89a4df7d80/output.txt

Total script time: 1.80 mins

Published

@timvandermeij timvandermeij merged commit d66d273 into mozilla:master Jul 6, 2019
@timvandermeij
Copy link
Contributor

Thank you! I agree that this should really work, and looking at how peekBytes and bytesToString work, this should indeed be equivalent, but more efficient.

@Snuffleupagus Snuffleupagus deleted the document-find-peekBytes branch July 6, 2019 13:50
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.

None yet

3 participants