mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-05 11:15:01 +03:00
perf(frontend): enable Wasm SIMD, remove unused UI code, and add a browser lifecycle harness
Build the playground bundle and the four preview workers with `simd128`. Pass the path remaps to the playground build. Pass `--enable-simd` to each `wasm-opt` call. Remove the Taffy `grid` feature and the grid style API. No caller uses them. Remove the unused wgpu `surface` pipeline and its shader entry points. Remove the unused `SwipeMenu` component. Remove the unused typography radii from the generated tokens. Share one progress bar function between the database table and the kanban card. Add `chromium-harness.mjs` for the browser verification scripts. The harness owns the work directory and each process group that a script starts. A normal end, a failed assertion, `SIGINT`, and `SIGTERM` stop each process group. Then the harness removes the directory. Chromium keeps its temporary files in the work directory. Use the harness in the two dual-shell verification scripts. Correct the repository root path in `verify-canary-dual-shell-e2e.mjs` and `stage-canary-dual-shell.mjs`. Record the SIMD worker sizes and the build flags in the preview `BENCHMARK.md`.
This commit is contained in:
1 parent
7dbb4efe41
commit
737fb5831d
26 files changed
+1092
-1341
No files matched your search
@@ -404,13 +404,15 @@ jobs:
|
||||
- name: Build WebAssembly bundle and run headless Chromium smoke test
|
||||
run: |
|
||||
mkdir -p artifacts ../../blocksuite/crates/playground/web/pkg
|
||||
cargo build --locked --profile wasm-release-size -p playground --lib --target wasm32-unknown-unknown
|
||||
WASM_RUSTFLAGS="$(printf '%s\037%s\037%s' "--remap-path-prefix=$(cd ../.. && pwd)=/src" "--remap-path-prefix=${CARGO_HOME:-$HOME/.cargo}=/cargo" "-Ctarget-feature=+simd128")"
|
||||
CARGO_ENCODED_RUSTFLAGS="$WASM_RUSTFLAGS" cargo build --locked --profile wasm-release-size -p playground --lib --target wasm32-unknown-unknown
|
||||
wasm-bindgen --target web --out-dir ../../blocksuite/crates/playground/web/pkg target/wasm32-unknown-unknown/wasm-release-size/playground.wasm
|
||||
wasm-opt -Oz --strip-debug --strip-producers \
|
||||
--enable-bulk-memory \
|
||||
--enable-nontrapping-float-to-int \
|
||||
--enable-sign-ext \
|
||||
--enable-mutable-globals \
|
||||
--enable-simd \
|
||||
../../blocksuite/crates/playground/web/pkg/playground_bg.wasm \
|
||||
-o ../../blocksuite/crates/playground/web/pkg/playground_bg.opt.wasm
|
||||
mv ../../blocksuite/crates/playground/web/pkg/playground_bg.opt.wasm ../../blocksuite/crates/playground/web/pkg/playground_bg.wasm
|
||||
|
||||
@@ -177,25 +177,27 @@ jobs:
|
||||
mkdir -p /tmp/preview-wasm/pkg
|
||||
REPO_ROOT="$(cd ../.. && pwd)"
|
||||
CARGO_HOME_DIR="${CARGO_HOME:-$HOME/.cargo}"
|
||||
WORKER_RUSTFLAGS="$(printf '%s\037%s' "--remap-path-prefix=${REPO_ROOT}=/src" "--remap-path-prefix=${CARGO_HOME_DIR}=/cargo")"
|
||||
WASM_RUSTFLAGS="$(printf '%s\037%s\037%s' "--remap-path-prefix=${REPO_ROOT}=/src" "--remap-path-prefix=${CARGO_HOME_DIR}=/cargo" "-Ctarget-feature=+simd128")"
|
||||
for kind in mermaid math typst pdf; do
|
||||
CARGO_ENCODED_RUSTFLAGS="$WORKER_RUSTFLAGS" cargo rustc --locked --target wasm32-unknown-unknown --profile wasm-worker-size -p blocksuite-preview --lib --crate-type cdylib --no-default-features --features "${kind},wasm-worker"
|
||||
CARGO_ENCODED_RUSTFLAGS="$WASM_RUSTFLAGS" cargo rustc --locked --target wasm32-unknown-unknown --profile wasm-worker-size -p blocksuite-preview --lib --crate-type cdylib --no-default-features --features "${kind},wasm-worker"
|
||||
wasm-opt -Oz --strip-debug --strip-producers \
|
||||
--enable-bulk-memory \
|
||||
--enable-nontrapping-float-to-int \
|
||||
--enable-sign-ext \
|
||||
--enable-mutable-globals \
|
||||
--enable-simd \
|
||||
"target/wasm32-unknown-unknown/wasm-worker-size/blocksuite_preview.wasm" \
|
||||
-o "/tmp/preview-wasm/${kind}.wasm"
|
||||
test -s "/tmp/preview-wasm/${kind}.wasm"
|
||||
done
|
||||
cargo build --locked --profile wasm-release-size -p playground --lib --target wasm32-unknown-unknown
|
||||
CARGO_ENCODED_RUSTFLAGS="$WASM_RUSTFLAGS" cargo build --locked --profile wasm-release-size -p playground --lib --target wasm32-unknown-unknown
|
||||
wasm-bindgen --target web --out-dir /tmp/preview-wasm/pkg target/wasm32-unknown-unknown/wasm-release-size/playground.wasm
|
||||
wasm-opt -Oz --strip-debug --strip-producers \
|
||||
--enable-bulk-memory \
|
||||
--enable-nontrapping-float-to-int \
|
||||
--enable-sign-ext \
|
||||
--enable-mutable-globals \
|
||||
--enable-simd \
|
||||
/tmp/preview-wasm/pkg/playground_bg.wasm \
|
||||
-o /tmp/preview-wasm/pkg/playground_bg.opt.wasm
|
||||
mv /tmp/preview-wasm/pkg/playground_bg.opt.wasm /tmp/preview-wasm/pkg/playground_bg.wasm
|
||||
|
||||
Reference in new issue
Block a user