Skip to content

Commit

Permalink
Update: Increase default doc chunk size to 384KB (#64)
Browse files Browse the repository at this point in the history
- Non-en-US locales will have an increased chunk size of 384KB
- An increased chunk size potentially requires more data to be downloaded before the first page, but reduces the overhead that each requests adds
  • Loading branch information
tonyjin authored Apr 11, 2017
1 parent 3a5bb41 commit ebbaccd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/viewers/doc/DocBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const SAFARI_PRINT_TIMEOUT_MS = 1000; // Wait 1s before trying to print
const PRINT_DIALOG_TIMEOUT_MS = 500;
const MAX_SCALE = 10.0;
const MIN_SCALE = 0.1;
const DEFAULT_RANGE_REQUEST_CHUNK_SIZE = 262144; // 256KB
const DEFAULT_RANGE_REQUEST_CHUNK_SIZE = 393216; // 384KB
const LARGE_RANGE_REQUEST_CHUNK_SIZE = 1048576; // 1MB
const SHOW_PAGE_NUM_INPUT_CLASS = 'show-page-number-input';
const IS_SAFARI_CLASS = 'is-safari';
Expand Down
6 changes: 3 additions & 3 deletions src/lib/viewers/doc/__tests__/DocBaseViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => {
});

beforeEach(() => {
fixture.load('viewers/doc/__tests__/DocBase-test.html');
fixture.load('viewers/doc/__tests__/DocBaseViewer-test.html');

containerEl = document.querySelector('.container');
docBase = new DocBaseViewer({
Expand Down Expand Up @@ -954,7 +954,7 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => {

it('should set a default chunk size if no viewer option set and locale is not en-US', () => {
const url = 'url';
const defaultChunkSize = 262144;
const defaultChunkSize = 393216; // 384KB

docBase.options.location = {
locale: 'not-en-US'
Expand All @@ -972,7 +972,7 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => {

it('should set a large chunk size if no viewer option set and locale is en-US', () => {
const url = 'url';
const largeChunkSize = 1048576;
const largeChunkSize = 1048576; // 1MB

docBase.options.location = {
locale: 'en-US'
Expand Down

0 comments on commit ebbaccd

Please sign in to comment.