Git Product home page Git Product logo

pspdfkit-webassembly-benchmark's Introduction

WebAssembly Benchmark by PSPDFKit

A Benchmark for WebAssembly (Wasm, WA) that uses PSPDFKit for Web Standalone.

The rendering engine of PSPDFKit for Web Standalone is written in C/C++ and compiled to Wasm.

Get your score in the live demo and learn more in our blog post.

Prerequisites

Getting Started

Install the pspdfkit npm package and move all contents to the vendor directory.

npm install --save pspdfkit
mkdir -p public/vendor
cp -R node_modules/pspdfkit/dist public/vendor/pspdfkit

Bootstrap the project by installing all the other dependencies.

npm install

Running the Benchmark

Now that PSPDFKit for Web is installed, you need to copy your product (license) key to the public/license-key file.

We can now run the benchmark server:

npm start

The benchmark is available at http://localhost:3000.

Building a Production Version

You can build an optimized version using the following command:

PUBLIC_URL="/webassembly-benchmark/" npm run build

Where PUBLIC_URL must be set according to the final URL, where the application is hosted.

Optimizations

The following optimizations can be enabled via URL parameter:

  • disableWebAssemblyStreaming, true by default
  • standaloneInstancesPoolSize, 0 by default
  • runsScaleFactor, scales the number of test runs, 1 by default

What's in This Repository

This repository contains files used to build the PSPDFKit WebAssembly benchmark.

The source files are structured into two different categories:

  • src/lib contains all files necessary to set up the test suite including the individual tests and helper functions.
  • src/ui contains a React application that is used to render the user interface.

For a main entry point, have a look at src/index.js.

License

This software is licensed under the MIT license.

Contributing

Please ensure you have signed our CLA so that we can accept your contributions.

pspdfkit-webassembly-benchmark's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pspdfkit-webassembly-benchmark's Issues

Replace "WASM" by "Wasm"

The correct abbreviation of "WebAssembly" is "Wasm", not "WASM".

See the first sentence in the spec:
WebAssembly (abbreviated Wasm [1]), is [...]

[1] A contraction of “WebAssembly”, not an acronym, hence not using
all-caps.

I found following occurrences in this project. All of them can just be replaced by "Wasm":

$ git grep WASM
README.md:The rendering engine of PSPDFKit for Web Standalone is written in C/C++ and compiled to WASM.
src/lib/tests.js:import { isWASMSupported, clearAllTimings, isMobileOS } from "./utils";
src/lib/tests.js: const isWasm = isWASMSupported() && !conf.disableWebAssembly;
src/lib/utils.js:// (WASM artifacts) which otherwise would influence the final benchmark
src/lib/utils.js:// The same WASM test that is used in PSPDFKit for Web
src/lib/utils.js:export function isWASMSupported() {
src/lib/utils.js: // iOS ~11.2.2 has a known WASM problem.
src/ui/components/Benchmark.js: ? "Initialization: compilation and instantiation of the WASM module"
src/ui/components/Benchmark.js:

PSPDFKit WASM Score

src/ui/components/Introduction.js: support WASM, we made a benchmark that runs a JavaScript version of

Older version (2020.6.4) of PSPDFKIT served by the benchmark?

I'm investigating a potential improvement to the WebAssembly performance in V8 / Chrome with inlining support in V8's optimizing JIT compiler for wasm.

I had run https://pspdfkit.com/webassembly-benchmark/ and the wasm binary served seems to have changed in the recent days:
Previously (10 day sago) I was getting pspdfkit-ffc054f2e674b6fc.wasm (13MiB), now it uses pspdfkit-85b702f2ed274c68.wasm (9.7MiB).
Looking at the current accompanying .wasm.js file, this is version 2020.6.4 and I can find the same wasm binary in that npm package version.
Looking at more recent binaries' sizes, it seems that my the ffc0[...].wasm binary should be a fairly recent version.

Did something change in the benchmark that causes it to use an old(er) version now?
Is the expectation that the benchmark would serve new versions to benefit from improvements on the PSPDFKIT code or is the version meant to be fixed?

To provide more context:
We have seen a significant improvement on the PSPDFKIT benchmark (~10%) when enabling inlining (a feature that is currently only enabled for wasm-gc modules).
We plan on enabling it for linear-memory wasm (like pspdfkit) but have seen some significant compile time regressions.
I'm preparing a change to use better inlining heuristics to get the performance improvements while not regressing too much on compile time.
The characteristics for PSPDFKIT now changed "overnight", the benchmark seems to be slightly slower overall and the performance benefits of enabling inlining are significantly reduced (to ~5%).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.