From a0976929bd096fd29cb3e354a2ccb852cbb3cbe8 Mon Sep 17 00:00:00 2001 From: Tony Jin Date: Tue, 11 Apr 2017 14:05:46 -0700 Subject: [PATCH] Update: Increase default doc chunk size to 384KB - 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 --- src/lib/viewers/doc/DocBaseViewer.js | 2 +- .../{DocBase-test.html => DocBaseViewer-test.html} | 0 src/lib/viewers/doc/__tests__/DocBaseViewer-test.js | 6 +++--- 3 files changed, 4 insertions(+), 4 deletions(-) rename src/lib/viewers/doc/__tests__/{DocBase-test.html => DocBaseViewer-test.html} (100%) diff --git a/src/lib/viewers/doc/DocBaseViewer.js b/src/lib/viewers/doc/DocBaseViewer.js index 04c6f5403..911af7b01 100644 --- a/src/lib/viewers/doc/DocBaseViewer.js +++ b/src/lib/viewers/doc/DocBaseViewer.js @@ -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'; diff --git a/src/lib/viewers/doc/__tests__/DocBase-test.html b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.html similarity index 100% rename from src/lib/viewers/doc/__tests__/DocBase-test.html rename to src/lib/viewers/doc/__tests__/DocBaseViewer-test.html diff --git a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js index ffa7f6cf3..82249c735 100644 --- a/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js +++ b/src/lib/viewers/doc/__tests__/DocBaseViewer-test.js @@ -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({ @@ -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' @@ -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'