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

Use Uint8ClampedArray when returning image data in src/core/jbig2.js and src/core/jpg.js #8783

Merged
merged 3 commits into from
Aug 16, 2017
Merged

Use Uint8ClampedArray when returning image data in src/core/jbig2.js and src/core/jpg.js #8783

merged 3 commits into from
Aug 16, 2017

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Aug 16, 2017

The following was done in a separate commit, to make it easy to revert just in case it's not a desired change: Remove manual clamping code in src/core/jpx.js

Since we're now using Uint8ClampedArray, rather than Uint8Array, doing manual clamping shouldn't be necessary given that that is now handled natively.

This shouldn't have any measurable performance impact, but just to sanity check that I've done some quick benchmarking with the following manifest file:

[
    {  "id": "S2-eq",
       "file": "pdfs/S2.pdf",
       "md5": "d0b6137846df6e0fe058f234a87fb588",
       "rounds": 100,
       "type": "eq"
    }
]

which gave the following results against the current master (repeated benchmark runs didn't result in any meaningful differences):

-- Grouped By browser, stat --
browser | stat         | Count | Baseline(ms) | Current(ms) | +/- |    %  | Result(P<.05)
------- | ------------ | ----- | ------------ | ----------- | --- | ----- | -------------
firefox | Overall      |   100 |          592 |         592 |   1 |  0.12 |
firefox | Page Request |   100 |            3 |           3 |   0 | -9.88 |
firefox | Rendering    |   100 |          588 |         589 |   1 |  0.18 |

…ble with both `Uint8Array` and `Uint8ClampedArray`
Since we're now using `Uint8ClampedArray`, rather than `Uint8Array`, doing manual clamping shouldn't be necessary given that that is now handled natively.

This shouldn't have any measurable performance impact, but just to sanity check that I've done some quick benchmarking with the following manifest file:
```json
[
    {  "id": "S2-eq",
       "file": "pdfs/S2.pdf",
       "md5": "d0b6137846df6e0fe058f234a87fb588",
       "rounds": 100,
       "type": "eq"
    }
]
```
which gave the following results against the current `master` (repeated benchmark runs didn't result in any meaningful differences):
```
-- Grouped By browser, stat --
browser | stat         | Count | Baseline(ms) | Current(ms) | +/- |    %  | Result(P<.05)
------- | ------------ | ----- | ------------ | ----------- | --- | ----- | -------------
firefox | Overall      |   100 |          592 |         592 |   1 |  0.12 |
firefox | Page Request |   100 |            3 |           3 |   0 | -9.88 |
firefox | Rendering    |   100 |          588 |         589 |   1 |  0.18 |
```
@pdfjsbot
Copy link

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://54.215.176.217:8877/1a58469edbb22ae/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

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

Total script time: 16.39 mins

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.215.176.217:8877/1a58469edbb22ae/output.txt

Total script time: 29.64 mins

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

@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/602f54cfa6813b8/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.67.70.0:8877/602f54cfa6813b8/output.txt

Total script time: 2.34 mins

Published

@timvandermeij timvandermeij merged commit 3a017b4 into mozilla:master Aug 16, 2017
@timvandermeij
Copy link
Contributor

Looks good. Thank you!

@Snuffleupagus Snuffleupagus deleted the image-decoders-Uint8ClampedArray branch August 17, 2017 07:08
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…t8ClampedArray

Use `Uint8ClampedArray` when returning image data in `src/core/jbig2.js` and `src/core/jpg.js`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants