Bringing Goodnotes to the web with Swift and WebAssembly
Goodnotes runs the same Swift code behind its iPad app in browsers by compiling it to WebAssembly with SwiftWasm, sharing 1.47M lines (66% of the 2.2M-line web codebase) including a rendering engine that targets Metal on iOS and WebGL on the web. The port required replacing libdispatch with Swift Concurrency, fixing code that assumed a 64-bit Int on wasm32, and abstracting I/O through dependency injection. WASI threads with Web Workers and SharedArrayBuffer, plus custom actor executors (SE-0392) that pin actors to specific workers, more than doubled INP but require cross-origin isolation. The roughly 50 MB binary (12 MB with Brotli) is cached with Service Workers, and Chrome DevTools debugging and a custom wasm-memprof heap profiler make the tooling workable. The WebAssembly support is upstreamed as of Swift 6.2.
Related posts
- This Month in Ladybird - July 2026
Ladybird mediumAdeptLadybird added private browsing, per-profile storage and sandboxing, undo/redo and rich-text editing, geolocation, and working WebAudio in July 2026, and moved most of LibWeb's style and layout pipeline to Rust. The JavaScript interpreter is now written in "flap", a typed language whose build-time compiler emits x86-64 and AArch64 handlers split into hot and cold sections. Declarative specialization trims BitwiseXor's hot path from 19 to 14 instructions and gives about 5% on compute-heavy JS benchmarks. Other changes include caging ArrayBuffer and Wasm memory inside a 4 TiB region to blunt exploits, 20–50x faster Wasm calls, and WebGL command passing via shared memory, which cut main-thread overhead from up to 40% to about 6%.
- This Month in Ladybird - May 2026
Ladybird easyNoviceLadybird merged 464 pull requests in May 2026. It now passes Cloudflare Turnstile, and scrolling runs asynchronously on an out-of-process compositor with crash recovery. Other major changes: a Cranelift-based WebAssembly JIT (about 8x on CoreMark), an on-disk JavaScript bytecode cache with lazy decoding that saves hundreds of megabytes on large sites, and incremental GC sweeping. The HTML and URL parsers are now written in Rust, and the Rust HTML parser is about 10% faster than the C++ one. Media Source Extensions are enabled by default, content blocking now uses adblock-rust, and the browser gains CSS container queries, @scope, subgrid and refreshed Qt UI work.
- Why is WebAssembly a second-class language on the web?
Mozilla Hacks mediumAdeptWebAssembly remains second-class on the web because it can only load code and reach Web APIs through JavaScript. That forces arcane instantiation boilerplate, language-specific glue code from tools like wasm-bindgen and embind, JS-centric documentation, and real runtime overhead. A 2020 TodoMVC experiment with the Dodrio Rust framework found that removing JS glue cut DOM-update time by 45%. The esm-integration proposal, being implemented in Firefox, simplifies loading, and the WebAssembly Component Model with WIT interfaces is proposed as a standardized artifact that could let Wasm call Web APIs directly with no JavaScript in between.
- This Month in Ladybird - October 2026
Ladybird easyNoviceLadybird moved style, layout and paint recording onto separate threads that run concurrently with JavaScript, so CSS animations (including layout-affecting ones) and :hover keep working during long scripts, while layout queries from script wait for pending work to avoid stale data. LibJS gained a speculative optimizing JIT for x86-64 and AArch64 driven by runtime type and shape profiling, validated with a differential fuzzer against the interpreter. A new Rust WebAssembly engine with a flap-written interpreter and tiered JIT replaced the C++ engine and Cranelift, scoring about 7x higher on JetStream 3 Wasm, and Ladybird passed Safari Technology Preview on WPT with help from AI coding agents. Other changes include finer process isolation (per-site network processes, out-of-process iframes), sandbox-escape fixes, more C++-to-Rust migration, a redesigned UI and many new CSS and web APIs.
- Introducing Turso in the Browser
Turso mediumAdeptTurso, a from-scratch SQLite rewrite, now runs in the browser via WebAssembly as the npm package @tursodatabase/database-wasm, with a better-sqlite3-like API whose methods are all async because of OPFS. Query compute runs on the main UI thread, since benchmarks showed offloading to a worker cost too much in communication overhead. A Web Worker handles filesystem I/O through the synchronous OPFS interface and shares buffers with the main thread via SharedArrayBuffer, which requires COOP/COEP headers and locks a database to one tab. The code is compiled to wasm32-wasip1-threads with napi-rs v3, and there are dedicated Vite and Turbopack exports plus a CDN build that inlines the WASM as base64 at the cost of a larger bundle.