Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 9 additions & 36 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ jobs:
cache-bin: false
- name: Prepare Output Directory
run: mkdir ${{ runner.temp }}/host-tools
- name: Build `cargo-js-sys`
working-directory: host
run: |
cargo ${{ matrix.os.sub-command }} build -p cargo-js-sys ${{ matrix.os.args }} --release
cp target/${{ matrix.os.path }}release/cargo-js-sys${{ matrix.os.exe }} ${{ runner.temp }}/host-tools/
- name: Build `js-bindgen-ld`
working-directory: host
run: |
cargo ${{ matrix.os.sub-command }} build -p js-bindgen-ld ${{ matrix.os.args }} --release
cp target/${{ matrix.os.path }}release/js-bindgen-ld${{ matrix.os.exe }} ${{ runner.temp }}/host-tools/
- name: Build `js-bindgen`
working-directory: host
run: |
cargo ${{ matrix.os.sub-command }} build -p js-bindgen-cli ${{ matrix.os.args }} --release
cp target/${{ matrix.os.path }}release/js-bindgen${{ matrix.os.exe }} ${{ runner.temp }}/host-tools/
- name: Build `js-bindgen-runner`
working-directory: host
run: |
Expand Down Expand Up @@ -139,6 +139,7 @@ jobs:
target-feature:
- { name: default }
- { name: atomics, rust: nightly, components: -c rust-src, description: Atomics }
- { name: exception-handling, rust: nightly, description: Exception Handling }

env:
JBG_DEV_TOOLS: 1
Expand Down Expand Up @@ -204,6 +205,7 @@ jobs:
target-feature:
- { name: default }
- { name: atomics, rust: nightly, components: -c rust-src, description: Atomics }
- { name: exception-handling, rust: nightly, description: Exception Handling }

env:
JBG_DEV_TOOLS: 1
Expand Down Expand Up @@ -255,7 +257,7 @@ jobs:

runs-on: ${{ matrix.runner.os }}

timeout-minutes: 20
timeout-minutes: 30

strategy:
fail-fast: false
Expand All @@ -276,6 +278,7 @@ jobs:
target-feature:
- { name: default }
- { name: atomics, rust: nightly, components: -c rust-src, description: " Atomics" }
- { name: exception-handling, rust: nightly, description: " Exception Handling" }
exclude:
- runner: { name: mac-os }
target: { name: wasm64 }
Expand Down Expand Up @@ -521,33 +524,3 @@ jobs:
- name: Test
working-directory: host
run: js-bindgen-dev host test -v

cargo-js-sys:
name: Check `cargo-js-sys`

needs: host-tools

runs-on: ubuntu-latest

timeout-minutes: 20

env:
JBG_DEV_TOOLS: 1

steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Download Host Tools
uses: actions/download-artifact@v8
with:
name: host-tools-linux
path: ${{ runner.temp }}/host-tools/
- name: Install Host Tools
run: |
chmod +x ${{ runner.temp }}/host-tools/*
echo "${{ runner.temp }}/host-tools" >> $GITHUB_PATH
- name: Check
working-directory: client
run: cargo-js-sys js-sys -c --workspace -v
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
/host/target
/host/Cargo.lock
/rust-toolchain.toml
/web/target
/web/Cargo.lock
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.mjs
/benchmarks/generated
/benchmarks/target
/host/cli-lib/src/js/imports.d.mts
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
`extern { fn <name> ... }` definition can shadow parameter values.
- `js-bindgen` macro custom section generation can produce name collisions with intermediate
variables.
- Allocate slots on the `externref` table in batches.
- Determine what to do with `js_sys::UnwrapThrowExt`. Avoiding the panic machinery is nice for some
very niche use-cases but it might be very annoying for most users. Maybe hide it behind a `cfg`
flag?
Expand Down
3 changes: 3 additions & 0 deletions benchmarks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/generated
/node_modules
/target
228 changes: 228 additions & 0 deletions benchmarks/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[workspace]
resolver = "3"
members = ["js-bindgen", "wasm-bindgen"]

[workspace.package]
edition = "2024"
license = "MIT OR Apache-2.0"
publish = false
29 changes: 29 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Benchmarks

Run the raw call benchmark with Node.js:

```console
npm install
node bench.mjs
```

Pass one or more case-insensitive substrings to run only matching benchmarks. Multiple filters are
combined with `OR`:

```console
node bench.mjs vec_u8 option_i32
```

The comparison uses the in-tree `js-bindgen` and the exact published `wasm-bindgen` version pinned
in `Cargo.toml`. The matching `wasm-bindgen` CLI must be available on `PATH`.

Warmup, batching, sampling, and statistics are handled by `mitata`. Every implementation of every
benchmark runs in a fresh process. The parent process aggregates the results after both
implementations finish, preventing one benchmark's JIT and GC state from affecting another.

The runner recreates the ignored `generated` directory on every invocation. Rust build artifacts
remain in `target` so subsequent filtered runs only rebuild changed inputs.

Benchmark functions are discovered from raw Wasm exports whose names start with `bench_`. To add a
benchmark, export the same `bench_*` function from both Rust crates. The runner infers Number,
BigInt, and reference parameters before measurement and gives every benchmark its own Wasm instance.
Loading