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

Small optimizations 1 #4895

Merged
merged 7 commits into from Jun 10, 2014
Merged

Conversation

p01
Copy link
Contributor

@p01 p01 commented Jun 5, 2014

A couple of small optimizations.

@@ -635,7 +635,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
assert(isName(type),
'XObject should have a Name subtype');

if (type.name === 'Form') {
if ('Form' === type.name) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason for this (and the next) change? I don't see how that would be more efficient, but if it is shouldn't this line be changed too: https://github.com/mozilla/pdf.js/blob/master/src/core/evaluator.js#L652?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No reason. This is a unhappy merge conflict resolution. I will revert the order of the equality check.

@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2014

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/d0aac24e67c4938/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2014

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/3b1f17287d9b310/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2014

From: Bot.io (Linux)


Failed

Full output at http://107.21.233.14:8877/d0aac24e67c4938/output.txt

Total script time: 3.74 mins

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

Image differences available at: http://107.21.233.14:8877/d0aac24e67c4938/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2014

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/3b1f17287d9b310/output.txt

Total script time: 3.82 mins

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

Image differences available at: http://107.22.172.223:8877/3b1f17287d9b310/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator

Running the tests locally, this PR timeouts at the same point as it does on the bots.

@@ -947,7 +947,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}

var glyphUnicode = glyph.unicode;
if (glyphUnicode in NormalizedUnicodes) {
if (NormalizedUnicodes[glyphUnicode] === undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probable typo: shouldn't it be !== instead?

@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2014

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/16099fc3ef1cb41/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2014

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/4c9c364c6e7640c/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2014

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/4c9c364c6e7640c/output.txt

Total script time: 23.07 mins

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

Image differences available at: http://107.22.172.223:8877/4c9c364c6e7640c/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

pdfjsbot commented Jun 5, 2014

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/16099fc3ef1cb41/output.txt

Total script time: 26.09 mins

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

@@ -394,6 +394,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
// Defines the time the executeOperatorList is going to be executing
// before it stops and shedules a continue of execution.
var EXECUTION_TIME = 15;
// Defines the number of steps before checking the execution time
var EXECUTION_STEPS = 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

We shall not batch long running operations such as paint image, shading pattern or smask compositing (on restore) -- scrolling will suffer and "long running script" dialog will pop-up. Please revert this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is essentially what the EXECUTION_TIME constant does.

But you're right.
I checked how many operations were processed within the EXECUTION_TIME across several PDFs and saw that the very minimum number was around 4-500 on my machine, and up to 30.000+. That's a lot of calls to Date.now() for nothing ... except I overlooked that my setup is pretty decent and this number of operations could well go as low as 40-50 on another machine.

How do you feel about using var EXECUTION_STEPS = 10; ?

I will run some tests to see the "cost" of the operations when batched by 10 to see whether the possibility of a "long running script" dialog is serious or that small batches contain at most one expensive operation and all the other ones are cheap.

Copy link
Contributor

Choose a reason for hiding this comment

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

How do you feel about using var EXECUTION_STEPS = 10; ?

Yep, we can do that. There will not be enough operators to e.g. create and then apply smask composition multiple times.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perfect!

@yurydelendik
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/080fe71c23dfbc6/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

Live output at: http://107.21.233.14:8877/7d32796f6023c2b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/080fe71c23dfbc6/output.txt

Total script time: 21.10 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/7d32796f6023c2b/output.txt

Total script time: 26.22 mins

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

yurydelendik added a commit that referenced this pull request Jun 10, 2014
@yurydelendik yurydelendik merged commit b2d8e73 into mozilla:master Jun 10, 2014
@yurydelendik
Copy link
Contributor

Thank you for the pull request

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