Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Optimizing load time

411 views
Skip to first unread message

alQemist

unread,
Oct 2, 2014, 4:04:39 PM10/2/14
to mozilla-d...@lists.mozilla.org
The biggest impediment for us is the load time - our content is mostly magazines and catalogs and the initial load times before rendering prevent it from be a viable option for our readers.

I am wondering if anyone has experimented with incremental loading or preloading pdf into cache using jQuery methods or XMLHTTPRequest. Seems that PDFs loaded a second time seem to load faster - I am thinking they are loaded from cache....

Otherwise Initial load takes 15-20 seconds in our testing which is an eternity on the web. Once this background loading is finished the actual page loading seems to begin and we get data in the progress callback for the download for our progress bar...This initial load seems to be the problem....



Yury Delendik

unread,
Oct 2, 2014, 4:21:14 PM10/2/14
to alQemist
On 10/2/14, 3:01 PM, alQemist wrote:
> The biggest impediment for us is the load time - our content is mostly magazines and catalogs and the initial load times before rendering prevent it from be a viable option for our readers.
>
> I am wondering if anyone has experimented with incremental loading or preloading pdf into cache using jQuery methods or XMLHTTPRequest. Seems that PDFs loaded a second time seem to load faster - I am thinking they are loaded from cache....
>

For non-web optimized PDFs, the important data is located at the end of
a PDF file. By default, PDF.js is trying to use HTTP range requests to
read this tail and any other important data to display first or visible
page(s).

If your web server or script that serves PDFs is not setup to handle
HTTP range requests, PDF.js will continue progressively fetching the
data until reaches the end. Some browsers (such as Safari) has defects
in handling/caching HTTP range request -- we disabled those there.

Recently we improved speed of downloading of entire files for the
browsers (Firefox) that support progressive binary data loading
(XMLHttpRequest cannot do that by default), and currently working on
supporting experimental Streams API.

Thanks,
Yury Delendik

alQemist

unread,
Oct 3, 2014, 2:41:54 PM10/3/14
to mozilla-d...@lists.mozilla.org
Thanks for this info. I have my PDF server using HTTP range request method for delivery - and my PDF are web optimized but I don't see any significant change in the load time.

There is such a long delay between the time when the request is sent and the first progress callback begins.
Is that normal ? Once the progress indicator starts it seems to load quick enough.

What about displaying first page while it is still loading ??

Yury Delendik

unread,
Oct 3, 2014, 3:08:39 PM10/3/14
to alQemist
PDF.js attempts to display the first page while PDF is loading is
required data for its display is delivered.

Please report this as an issue at github [1], and provide public access
to your example and PDF as requested [2]. Additionally you can also
provide network analysis of the HTTP traffic and browser profiling data.

Thanks.

[1] https://github.com/mozilla/pdf.js/issues/new
[2] https://github.com/mozilla/pdf.js/blob/master/CONTRIBUTING.md

alQemist

unread,
Oct 5, 2014, 10:25:22 AM10/5/14
to mozilla-d...@lists.mozilla.org
I notice when I call PDF.getDocument one by one the following js are loaded then finally the actual request is made for the PDF file - is this normal ? or can I somehow preload these to eliminate this delay ?

Yury Delendik

unread,
Oct 5, 2014, 10:35:42 AM10/5/14
to alQemist
On 10/5/14, 9:03 AM, alQemist wrote:
> I notice when I call PDF.getDocument one by one the following js are loaded then finally the actual request is made for the PDF file - is this normal ? or can I somehow preload these to eliminate this delay ?
>

See "pdf.worker.js and other js files make for a large client download"
thread [1]. The pdf.worker.js file must be loaded into separate
"thread"/web worker -- that makes PDF.js more UI responsive. With
properly configured HTTP web server (see Keep-Alive [2] and Cache [3]
HTTP headers specifications) this shall not be an issue.

Thanks.

[1]
https://groups.google.com/d/msg/mozilla.dev.pdf-js/8B6iCsj5Hkg/qGjxTLbaJggJ
[2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
[3] http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
0 new messages