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

[api-minor] Add an optional param to DocumentInitParameters for speci… #6568

Merged
merged 1 commit into from
Oct 28, 2015

Conversation

tonyjin
Copy link

@tonyjin tonyjin commented Oct 26, 2015

…fying the range request chunk size to use. Defaults to 2^16 = 65536.

This would allow developers to configure the range request chunk size that best matches their performance and usage needs.

For example, an app serving PDFs that are mostly smaller than 512KB in size can set a range request chunk size of 256KB. Since we don't download with range requests if the file size is less than 2 * chunk size, the majority of PDFs in this app are fully downloaded and cached. For the remaining larger files, the app can still benefit from downloading via range requests.

@@ -299,6 +302,9 @@ PDFJS.getDocument = function getDocument(src,
source = src;
}

// Default range chunk size to 2^16 = 65536
source.rangeChunkSize = source.rangeChunkSize || 65536;
Copy link
Contributor

Choose a reason for hiding this comment

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

Make 65536 a constant (at least justbefore this statement).

Can you use params object (instead of source) -- we don't want to mutate the original parameter?

Copy link
Contributor

Choose a reason for hiding this comment

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

As alternative, you can move the constant and default value replacement into the ChunkedStreamManager constructor.

Copy link
Author

Choose a reason for hiding this comment

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

Done, decided against adding the default in the ChunkedStreamManager constructor since we still need that value in getPdfManager() in worker.js.

@tonyjin tonyjin force-pushed the api-rangeChunkSize branch from 4a4ed0f to ef66782 Compare October 27, 2015 00:21
…fying the range request chunk size to use. Defaults to 2^16 = 65536.
@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

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

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

@timvandermeij
Copy link
Contributor

/botio test

@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/79ecf3b2c1afe12/output.txt

@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/33bf79a026990df/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/79ecf3b2c1afe12/output.txt

Total script time: 18.69 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/33bf79a026990df/output.txt

Total script time: 19.81 mins

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

@timvandermeij
Copy link
Contributor

Looks good to me.

yurydelendik added a commit that referenced this pull request Oct 28, 2015
[api-minor] Add an optional param to DocumentInitParameters for speci…
@yurydelendik yurydelendik merged commit d26ef21 into mozilla:master Oct 28, 2015
@yurydelendik
Copy link
Contributor

Thank you for the patch

@tonyjin
Copy link
Author

tonyjin commented Oct 28, 2015

Whoo!

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.

4 participants