WebGPU demo: a live data grid in the browser

The demo draws with WebGPU where the browser has an adapter for it, and with WebGL 2 where it has not.
Most WebGPU demos are 3D scenes. This one is an application’s interface: a data grid of 150 simulated quotes grouped by sector, where each cell that changes flashes green or red and the sector rows keep live averages. None of it is HTML. The table, its text and its scrollbars are drawn on one canvas, at about 300 updates a second.
How it is drawn
Section titled “How it is drawn”- The interface is GPUI, the UI framework of the Zed editor. It lays the window out and paints it on the GPU as quads, glyphs and paths.
- The table is gpui-kit-grid, a data grid for GPUI written in Rust. One element paints the visible cells; sorting and grouping run in the background, between frames in a browser.
- The page runs WebAssembly. The same Rust code that opens a desktop
window is compiled for
wasm32-unknown-unknown: about 7 MB to download, loaded when you press the button. - WebGPU first, WebGL 2 otherwise. The demo asks the browser for a WebGPU adapter and falls back to WebGL 2 without one. The same demo on WebGL 2 looks the same.
More WebGPU examples
Section titled “More WebGPU examples”The same grid under other loads, each on a page of its own:
- a data center in an alert storm: 5,760 hosts and about 1,550 alert updates a second;
- a trading terminal: several grids, a candle chart and an order book in one window;
- a trade blotter that fills as you place orders.
Examples has all eight that run in the browser, Web how they are built and their frame times, and Performance the measurements on the desktop.
Embed it
Section titled “Embed it”Two lines show this demo on any page, and Play recolours it first. Embedding has the element’s attributes.
<script type="module" src="https://gkg.giglabo.com/embed/v1/live-grid.js"></script><live-grid app="quotes" autoload></live-grid>Apache-2.0, built on gpui-kit. Repository Sponsor More from GigLabo Privacy Licenses