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

Graphic optimizations 1 #4708

Merged
merged 6 commits into from
May 5, 2014
Merged

Conversation

p01
Copy link
Contributor

@p01 p01 commented Apr 29, 2014

The main optimizations here are in the CalGrayCS conversion and JPG decoder's getLinearizedBlockData and convertCmykToRgb which got 2.16x and 1.5x faster respectively while using less memory ( and generating less garbage collection ).

@Snuffleupagus
Copy link
Collaborator

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/52cacf1685a64fa/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/52cacf1685a64fa/output.txt

Total script time: 22.17 mins

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

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

@pdfjsbot
Copy link

From: Bot.io (Linux)


Failed

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

Total script time: 26.70 mins

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

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

@timvandermeij
Copy link
Contributor

Something has gone with with the CalGrayCS refactoring I think, given that all CalGray tests fail.

@p01
Copy link
Contributor Author

p01 commented Apr 30, 2014

Thanks. Good thing all the CalGray test failed. Made it easier to fix them all :)

@p01
Copy link
Contributor Author

p01 commented Apr 30, 2014

As usual when working on/optimizing color conversions, there might be rounding errors here and there, but nothing noticeable.

y = data[i + 2] * 0.00392156862745098;
k = data[i + 3] * 0.00392156862745098;
var length = data.length;
var min = -255 *255 * 255;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: missing space after the first multiplication sign.

@p01
Copy link
Contributor Author

p01 commented Apr 30, 2014

Thanks!
Any chance to get a run of pdfjsbot ?

@yurydelendik
Copy link
Contributor

/botio test

@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/5cc9c869a85b530/output.txt

@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/3ce17d6cbd0b940/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://107.22.172.223:8877/5cc9c869a85b530/output.txt

Total script time: 1.19 mins

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

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

@yurydelendik
Copy link
Contributor

/botio-windows test

@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/0e123f29fdd66a4/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/3ce17d6cbd0b940/output.txt

Total script time: 25.82 mins

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/0e123f29fdd66a4/output.txt

Total script time: 22.05 mins

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

@p01
Copy link
Contributor Author

p01 commented Apr 30, 2014

Is the commit history OK or should I squash some/all ?

@yurydelendik
Copy link
Contributor

I think we are fine, but we might be missing the polyfill for Uint8Array

@p01
Copy link
Contributor Author

p01 commented Apr 30, 2014

Which polyfill ?

About the history, I just noticed 2 fixups squashed in the wrong commit. I'll tidy this up on Friday, or squash it all to one commit tomorrow, as you prefer.

r = (buffer[i] - matteR) * k + matteR;
g = (buffer[i + 1] - matteG) * k + matteG;
b = (buffer[i + 2] - matteB) * k + matteB;
buffer[i] = r <= 0 ? 0 : r >= 255 ? 255 : r | 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking moving cast to int32 (r | 0) above and giving r the int32 type might speedup the comparison operations (r <= 0 and r >= 255). I run tests at http://jsperf.com/precast to confirm this

Copy link
Contributor

Choose a reason for hiding this comment

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

I contributed two test runs on IE11 (listed as Other by JSPerf) besides being significantly slower than real browsers, in IE the "after" code was faster.

@p01
Copy link
Contributor Author

p01 commented May 2, 2014

I just ran Yury's test in Opera 22 and IE 11 on my 2-3yo desktop computer. Casting before hand was 23% and 12% faster respectively.

Thanks for the test. The results do make sense.
We can't ignore a potential 12-23% speed improvement. I will see where pre-casting helps.

p01 added 2 commits May 5, 2014 14:36
…lockData

Linearize and scale the mcu blocks into the destination buffer in a single pass
@timvandermeij
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

pdfjsbot commented May 5, 2014

From: Bot.io (Windows)


Received

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

Live output at: http://107.22.172.223:8877/8038daccdb1bacf/output.txt

@pdfjsbot
Copy link

pdfjsbot commented May 5, 2014

From: Bot.io (Linux)


Received

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

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

@pdfjsbot
Copy link

pdfjsbot commented May 5, 2014

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/8038daccdb1bacf/output.txt

Total script time: 22.10 mins

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

@pdfjsbot
Copy link

pdfjsbot commented May 5, 2014

From: Bot.io (Linux)


Success

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

Total script time: 25.65 mins

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

yurydelendik added a commit that referenced this pull request May 5, 2014
@yurydelendik yurydelendik merged commit 7ac1d6c into mozilla:master May 5, 2014
@yurydelendik
Copy link
Contributor

Thank you for the patch

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.

6 participants