Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having issues with loading .wasm files in benchmarks #267

Open
dsafa opened this issue Aug 26, 2024 · 0 comments
Open

Having issues with loading .wasm files in benchmarks #267

dsafa opened this issue Aug 26, 2024 · 0 comments

Comments

@dsafa
Copy link

dsafa commented Aug 26, 2024

I'm interested in running some code that uses wasm, but when running the benchmarks, it throws compile errors. For example:

Uncaught CompileError: WebAssembly.instantiateStreaming(): section (code 1, "Type") extends past end of the module (length 9396207, remaining bytes 1347243) @+8

Looking at the network tab and downloading the wasm binary from there, it is different than the file that is located in node_modules, so it seems like its being modified somewhere.

Here is a small test case

index.html

<script type="module">
import * as bench from '/bench.js';

const brotli = await import("brotli-wasm/index.web.js").then(m => m.default);

const textEncoder = new TextEncoder();
const input = 'some input';

const uncompressedData = textEncoder.encode(input);

bench.start();
const compressedData = brotli.compress(uncompressedData);
bench.stop();

</script>

package.json

{
  "name": "tachometer-wasm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {},
  "author": "",
  "license": "ISC",
  "dependencies": {
    "brotli-wasm": "^3.0.1"
  }
}

Reproduction steps:

  1. run tachometer ./index.html

Expected results:

  1. No errors and benchmark should run

Actual:

  1. there is a CompileError thrown and the file brotli_wasm_bg.wasm fetched by the browser differs from the file in node_modules\brotli-wasm\pkg.web\brotli_wasm_bg.wasm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@dsafa and others