WebAssembly is intermediate code that needs to be compiled in the browser. We use various advanced techniques to improve performance. See the Optimizing WebAssembly Startup Time blog post for more on this. Additionally, you can use our Real-World WebAssembly Benchmark to test the performance of your browser and OS.
Initial loading performance on modern machines is in the range of 3–9 seconds. Once the component is loaded, switching documents is nearly instant.
This table shows the average download time for the WebAssembly artifacts (~9 MB, ~3.7 MB gzipped) for different network conditions:
|Network||Speed (Mbit/s)||Download Time (s)||Download Time (s, gzipped)|
These figures apply only to the first time the page is loaded, as subsequent requests will be much faster since the browser cache will be used.
ScrollMode.CONTINUOUS is set as
ViewState#scrollMode, there are a certain number of pages of the document above and below the currently viewed one that PSPDFKit for Web keeps in memory at each moment. This is done to keep our memory footprint in check and avoid slowing down scrolling performance, as more DOM nodes need to be retained. For this reason, on a document with many pages, switching back and forth between pages that are distant from each other requires rerendering them, and that could require some time.
The rerendering strategy on a standalone deployment is different from a PSPDFKit for Web Server deployment, where the different pages are stored on the browser’s network cache so that a repeated request for a page that was previously loaded can be resolved instantly.
In 2017, all browsers started supporting WebAssembly (see WebAssembly: A New Hope), and since 2018 it’s been getting really fast.
Firefox’s new streaming and tiering compiler helps decrease even the initial loading time to around half of what other browsers require.
Update 20 August 2018: Google released Liftoff, a new baseline compiler for WebAssembly in V8. The blog post includes specific benchmarks for PSPDFKit, showing a 56%+ faster initialization time.
Preloading WebAssembly Artifacts
Standalone deployments can make use of the
PSPDFKit.preloadWorker function to fetch WebAssembly artifacts in advance so that when the actual document is loaded they are already available. This can greatly enhance the user experience by minimizing the time the user has to wait for these files to load.
If you don’t open a PDF document right away after loading PSPDFKit, consider boosting subsequent document loading time by using
PSPDFKit is committed to being at the forefront of this innovative technology, and our goal is to make standalone deployment as fast as server-based deployment.