|
| 1 | +> ⚠️ **Repository Moved** |
| 2 | +> This repository has been moved to https://github.com/PSPDFKit/nutrient-web-examples/tree/main/examples/wasm-benchmark. |
| 3 | +> Please update your bookmarks and issues accordingly. |
| 4 | +> |
| 5 | +> This repo is now archived and will no longer receive updates. |
| 6 | +
|
| 7 | +<center> |
| 8 | + <a href="http://iswebassemblyfastyet.com/"> |
| 9 | + <img src="https://www.nutrient.io/assets/images/blog/2018/webassembly-benchmark/article-header.png?commit=d5901d372044382ad59d52a0dac7d4a136db7816" width="1000" style="max-width: 100%;"> |
| 10 | + </a> |
| 11 | +</center> |
| 12 | + |
| 13 | +# WebAssembly Benchmark by Nutrient |
| 14 | + |
| 15 | +A Benchmark for WebAssembly (Wasm, WA) that uses [Nutrient Web](https://www.nutrient.io/sdk/web/) Standalone. |
| 16 | + |
| 17 | +The rendering engine of [Nutrient Web](https://www.nutrient.io/sdk/web/) Standalone is written in C/C++ and compiled to Wasm. |
| 18 | + |
| 19 | +Get your score in the [live demo](http://iswebassemblyfastyet.com/) and learn more in our [blog post](https://www.nutrient.io/blog/2018/a-real-world-webassembly-benchmark/). |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +- [Node.js](http://nodejs.org/) (with npm or Yarn) |
| 24 | +- A Nutrient Web license. If you don't already have one |
| 25 | + you can [request a free trial here](https://www.nutrient.io/try/). |
| 26 | + |
| 27 | +## Getting Started |
| 28 | + |
| 29 | +Install the `nutrient` npm package and move all contents to the vendor directory. |
| 30 | + |
| 31 | +```bash |
| 32 | +npm install --save @nutrient-sdk/viewer |
| 33 | +mkdir -p public/vendor |
| 34 | +cp -R node_modules/nutrient/dist public/vendor/nutrient |
| 35 | +``` |
| 36 | + |
| 37 | +Bootstrap the project by installing all the other dependencies. |
| 38 | + |
| 39 | +```bash |
| 40 | +npm install |
| 41 | +``` |
| 42 | + |
| 43 | +## Running the Benchmark |
| 44 | + |
| 45 | +Now that Nutrient Web is installed, you need to copy your product (license) key to the `public/license-key` file. |
| 46 | + |
| 47 | +We can now run the benchmark server: |
| 48 | + |
| 49 | +```bash |
| 50 | +npm start |
| 51 | +``` |
| 52 | + |
| 53 | +The benchmark is available at `http://localhost:3000`. |
| 54 | + |
| 55 | +## Building a Production Version |
| 56 | + |
| 57 | +You can build an optimized version using the following command: |
| 58 | + |
| 59 | +```bash |
| 60 | +PUBLIC_URL="/webassembly-benchmark/" npm run build |
| 61 | +``` |
| 62 | + |
| 63 | +Where `PUBLIC_URL` must be set according to the final URL, where the application is hosted. |
| 64 | + |
| 65 | +## Optimizations |
| 66 | + |
| 67 | +The following optimizations can be enabled via URL parameter: |
| 68 | + |
| 69 | +- `disableWebAssemblyStreaming`, `true` by default |
| 70 | +- `standaloneInstancesPoolSize`, `0` by default |
| 71 | +- `runsScaleFactor`, scales the number of test runs, `1` by default |
| 72 | + |
| 73 | +## What's in This Repository |
| 74 | + |
| 75 | +This repository contains files used to build the [Nutrient WebAssembly benchmark](http://iswebassemblyfastyet.com/). |
| 76 | + |
| 77 | +The source files are structured into two different categories: |
| 78 | + |
| 79 | +- `src/lib` contains all files necessary to set up the test suite including the individual tests and helper functions. |
| 80 | +- `src/ui` contains a [React](https://reactjs.org/) application that is used to render the user interface. |
| 81 | + |
| 82 | +For a main entry point, have a look at `src/index.js`. |
| 83 | + |
| 84 | +## License |
| 85 | + |
| 86 | +This software is licensed under [the MIT license](LICENSE). |
| 87 | + |
| 88 | +## Contributing |
| 89 | + |
| 90 | +Please ensure |
| 91 | +[you have signed our CLA](https://www.nutrient.io/guides/web/current/miscellaneous/contributing/) so that we can |
| 92 | +accept your contributions. |
0 commit comments