Some test text!

Loading...
Guides
WebAssembly Threads

WebAssembly Threads

For optimal performance, the PDFTron SDK API uses two different technologies to run its processes, WebAssembly Threads and Emscripten.

  • WebAssembly Threads can utilize multiple threads simultaneously to provide better performance but is only supported on Google Chrome for Desktop and the latest versions of Edge and Firefox.

  • Emscripten (which compiles both non-threaded WebAssembly and asm.js implementations) is compatible with most browsers but has slower runtime performance.

WebAssembly Threads will be enabled by default if the server is configured correctly and the browser supports this feature. All other cases will default to our single-threaded WebAssembly/asm.js solution.

Configuring your website

Configured correctly refers to the requirement that some browsers require websites to be "cross-origin isolated" with COOP and COEP to enable the SharedArrayBuffer, which is needed by WebAssembly Threads. To set up your website, please refer to https://web.dev/coop-coep/ for more details.

If it's not configured you may see a warning like this in Chrome "[Deprecation] SharedArrayBuffer will require cross-origin isolation as of M91, around May 2021. See https://developer.chrome.com/blog/enabling-shared-array-buffer/ for more details."

If applying the configuration to the whole website is not favorable, you can make individual pages "cross-origin isolated". The key parts from https://web.dev/coop-coep/ are:

  • From the page that contains WebViewer set the header Cross-Origin-Opener-Policy: same-origin
  • From the page that contains WebViewer and the WebViewer lib folder set the header Cross-Origin-Embedder-Policy: require-corp

Get the answers you need: Support