July 10th, 2024

We sped up Notion in the browser with WASM SQLite

Notion improved web performance with WebAssembly SQLite, enhancing navigation by 20% in modern browsers. SharedWorker architecture managed SQLite queries efficiently, overcoming initial challenges for a seamless user experience.

Read original articleLink Icon
We sped up Notion in the browser with WASM SQLite

The article discusses how Notion improved its performance in web browsers by implementing WebAssembly (WASM) SQLite. By using the OPFS and Web Workers technologies, Notion was able to enhance page navigation times by 20 percent in modern browsers. The architecture involved a SharedWorker-powered approach to manage SQLite queries from multiple tabs efficiently. Initially, simpler approaches faced challenges like cross-origin isolation requirements and corruption issues due to concurrency problems. Notion overcame these obstacles by developing a SharedWorker architecture that allowed for efficient SQLite usage across tabs. Despite initial regressions like slower initial page loads and certain devices not benefiting from caching, Notion optimized the implementation to ensure a seamless user experience. By choosing the OPFS SyncAccessHandle Pool VFS variant, Notion avoided the need for cross-origin isolation, enabling the feature to be rolled out to a wider range of browsers. Overall, the article highlights the technical intricacies and solutions involved in speeding up Notion in web browsers using WASM SQLite.

Related

What Happens When You Put a Database in the Browser?

What Happens When You Put a Database in the Browser?

WebAssembly (Wasm) enhances browser capabilities, enabling high-performance apps like DuckDB for ad-hoc queries and Python environments. DuckDB Wasm boosts performance in interfaces like lakeFS, Evidence, and Count. MotherDuck enables local querying, emphasizing efficient data processing.

Why Google Sheets ported its calculation worker from JavaScript to WasmGC

Why Google Sheets ported its calculation worker from JavaScript to WasmGC

Google Sheets transitioned its calculation worker to WasmGC from JavaScript for improved performance. Collaboration between Sheets and Chrome teams led to optimizations, overcoming challenges for near-native speed on the web.

Enhancing New York Times Web Performance with React 18

Enhancing New York Times Web Performance with React 18

The New York Times upgraded to React 18 for better performance and new features like Concurrent Mode and server-side rendering. Challenges with "embedded interactives" were overcome, leading to improved website performance.

Optimizing Large-Scale OpenStreetMap Data with SQLite

Optimizing Large-Scale OpenStreetMap Data with SQLite

The article discusses optimizing large-scale OpenStreetMap data with SQLite. Converting OSMPBF to SQLite enhanced search functionalities. Indexing, full-text search, and compression improved query performance, despite some false positives.

WASI API: Capabilities and Filesystems

WASI API: Capabilities and Filesystems

The blog post delves into WASI's filesystem API design, focusing on handles, sandboxing, and avoiding absolute paths for security. It discusses ambient authority, access control, typed APIs, and future authority evolution. Emphasizes enhancing compatibility with existing tools.

Link Icon 3 comments
By @Fudgel - 3 months
Pretty cool. First time I'd heard about the web locks api. https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_A...
By @sgbeal - 3 months
This part:

> ... the requirement of cross-origin isolation, which would have prevented us from rolling out to any browser beyond Chrome and Edge.

Is incorrect. The primary development browser for the two VFS APIs they're writing about is Firefox. (Citation: that development all happens on my computer.)

By @camgunz - 3 months
Great write up; but honestly all I could think is what a blunder it was when Mozilla vetoed shipping SQLite.