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

Restructured EvaluatorPreprocessor_read to be more natural. #4976

Merged
merged 1 commit into from Jun 24, 2014
Merged

Restructured EvaluatorPreprocessor_read to be more natural. #4976

merged 1 commit into from Jun 24, 2014

Conversation

CodingFabian
Copy link
Contributor

As pointed out previously, the read method is invoked frequently (thousands to millions). In that loop always checking for EOF and than for not Command.
These are two checks for figuring out the most common case.
By changing it to a check for a command, the EOF check is implicitly done.
It also saves the continue logic as the valid command case sits safely inside an if block.

for easier review use:
https://github.com/mozilla/pdf.js/pull/4976/files?w=1

@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/40017ebbf320d88/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/3291b98669297d1/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/3291b98669297d1/output.txt

Total script time: 21.13 mins

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/40017ebbf320d88/output.txt

Total script time: 23.63 mins

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

@yurydelendik
Copy link
Contributor

Any benchmark/profile results?

@CodingFabian
Copy link
Contributor Author

no, from an optimization perspective this is pure micro optimization (it saves on method invocation, which is most likely inlines, and one check).
I personally think the new code branching is easier to follow. but if the project decides that the old code is better, then I have no problem with that either.

@timvandermeij
Copy link
Contributor

@CodingFabian Could you rebase the PR?

@CodingFabian
Copy link
Contributor Author

rebased

@yurydelendik
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/9728bf6c07d2540/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/c22f87559474054/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/c22f87559474054/output.txt

Total script time: 21.23 mins

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

var numArgs = opSpec.numArgs;

if (!opSpec.variableArgs) {
// Some post script commands can be nested, e.g. /F2 /GS2 gs 5.711 Tf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/core/evaluator.js: line 2120, col 81, Line is too long.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps changing post script to PostScript is already enough :)

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/9728bf6c07d2540/output.txt

Total script time: 23.62 mins

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

@CodingFabian
Copy link
Contributor Author

i had fixed that. got lost in the rebase :)

yurydelendik added a commit that referenced this pull request Jun 24, 2014
Restructured EvaluatorPreprocessor_read to be more natural.
@yurydelendik yurydelendik merged commit bb7e7d3 into mozilla:master Jun 24, 2014
@yurydelendik
Copy link
Contributor

Thanks

@CodingFabian CodingFabian deleted the restructure-evaluator-read branch June 24, 2014 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants