Skip to content
Merged
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
14 changes: 9 additions & 5 deletions .github/actions/install-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ inputs:
skip_cache:
default: "false"
description: "Don't use cache from previous builds"
ccache:
default: ""
description: "Install ccache with this cache key (empty = disabled); build steps must also set PSP_USE_CCACHE"

runs:
using: "composite"
Expand Down Expand Up @@ -115,11 +118,12 @@ runs:
restore-keys: |
${{ runner.os }}-cargo-

# - name: ccache
# uses: hendrikmuhs/ccache-action@v1.2
# if: ${{ inputs.skip_cache == 'false' }}
# with:
# key: ${{ github.job }}-${{ matrix.os }}
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
if: ${{ inputs.ccache != '' && inputs.skip_cache == 'false' }}
with:
key: ${{ inputs.ccache }}
max-size: "1G"

# https://github.com/apache/arrow/issues/38391
- if: ${{ runner.os == 'macOS' }}
Expand Down
71 changes: 69 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,14 @@ jobs:
clean: "true"
python: "false"
playwright: "true"
ccache: "emscripten-wasm32"
skip_cache: ${{ steps.config-step.outputs.SKIP_CACHE }}

- name: WebAssembly Build
run: pnpm run build --ci
env:
PACKAGE: "server,client,viewer,viewer-datagrid,viewer-charts,react,anywidget"
# PSP_USE_CCACHE: 1
PSP_USE_CCACHE: "1"

- uses: actions/upload-artifact@v4
with:
Expand All @@ -179,6 +180,56 @@ jobs:
rust/perspective-python/perspective/widget/static/perspective-anywidget.js
rust/perspective-python/perspective/widget/static/perspective-anywidget.css

# The Memory64 engine recompiles the entire C++ dependency chain under
# `-sMEMORY64` (no object sharing with wasm32 is possible), so it builds
# on its own runner in parallel with `build_js` rather than doubling that
# job's wall clock. Downstream jobs merge this single-file artifact into
# `rust/perspective-server/dist/wasm/`.
build_js_wasm64:
runs-on: ${{ matrix.os }}
needs: [lint_and_docs]
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
node-version: [22.x]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Config
id: config-step
uses: ./.github/actions/config

- uses: actions/download-artifact@v4
with:
name: perspective-metadata
path: rust/

- name: Initialize Build
id: init-step
uses: ./.github/actions/install-deps
with:
clean: "true"
python: "false"
playwright: "true"
ccache: "emscripten-wasm64"
skip_cache: ${{ steps.config-step.outputs.SKIP_CACHE }}

- name: WebAssembly Build (Memory64)
run: pnpm run build --ci
env:
PACKAGE: "server"
PSP_WASM64: "only"
PSP_USE_CCACHE: "1"

- uses: actions/upload-artifact@v4
with:
name: perspective-server-wasm64-dist
path: rust/perspective-server/dist/wasm/perspective-server.memory64.wasm

# ,-,---. . . .-,--. . .
# '|___/ . . . | ,-| '|__/ . . |- |-. ,-. ,-.
# ,| \ | | | | | | ,| | | | | | | | | |
Expand Down Expand Up @@ -654,7 +705,7 @@ jobs:
# /` | |
# `--' '
test_js:
needs: [build_js]
needs: [build_js, build_js_wasm64]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -687,6 +738,11 @@ jobs:
name: perspective-js-dist
path: .

- uses: actions/download-artifact@v4
with:
name: perspective-server-wasm64-dist
path: rust/perspective-server/dist/wasm

- name: Run Tests
id: run_tests
run: pnpm run test -- --fetch-snapshots
Expand Down Expand Up @@ -989,6 +1045,7 @@ jobs:
needs:
[
build_and_test_jupyterlab,
build_js_wasm64,
test_python,
test_python_sdist,
test_js,
Expand Down Expand Up @@ -1068,6 +1125,16 @@ jobs:
- run: pnpm pack --pack-destination=../..
working-directory: ./rust/perspective-js

- uses: actions/download-artifact@v4
with:
name: perspective-server-wasm64-dist
path: rust/perspective-server/dist/wasm

# `files` globs don't fail on absence, so a silently-skipped
# memory64 build would otherwise publish a wasm32-only package.
- name: Assert wasm64 engine asset
run: test -f rust/perspective-server/dist/wasm/perspective-server.memory64.wasm

- run: pnpm pack --pack-destination=../..
working-directory: ./rust/perspective-server

Expand Down
17 changes: 17 additions & 0 deletions docs/md/how_to/javascript/importing.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ const viewer = document.createElement("perspective-viewer");

The exact syntax will vary slightly depending on the bundler.

### Memory64 (wasm64)

`@perspective-dev/server` also ships a WebAssembly Memory64 build of the
engine, `dist/wasm/perspective-server.memory64.wasm`, which raises the
engine's heap ceiling from 4GB to 16GB (at some engine performance cost).
`init_server` accepts both binaries at once — register each as a _thunk_ and
only the selected binary is ever downloaded. The wasm64 binary is used
whenever the browser supports Memory64; registering only the wasm32 binary
(as above) opts out.

```javascript
perspective.init_server({
wasm32: () => fetch(SERVER_WASM),
wasm64: () => fetch(SERVER_WASM64),
});
```

### Vite

```javascript
Expand Down
Loading
Loading