Component benchmarks

JavaScript syntax highlighting

Edit JavaScript below to highlight it in your browser and on the server. Both previews use the same QIP WebAssembly component to transform HTML containing code into highlighted HTML.

JavaScript source

Live preview

JavaScript and JSX · code is highlighted, never executed

In your browser

Loading…

On the server

Waiting…

Loading the highlighter component…

How the two previews match

The server runs the component using Wasmex, an Elixir library backed by Wasmtime. The CalculatedWorld.Qip.HTMLTransform Plug applies the CalculatedWorld.Recipes.HighlightCode recipe to the HTML response before sending it. The browser runs the same component using its built-in WebAssembly runtime.

Both receive the source wrapped in the same HTML. The component's TSX highlighter supports JavaScript and JSX. This page compares the returned HTML byte for byte and checks that the component's SHA-256 hash matches on both sides.

Browser time measures local execution. Server time measures the highlighter call, including creating and stopping a Wasm instance. Round-trip time measures the HTTP request through receiving the response body.

Component SHA-256: b7f26b07d4da1741832e88b0f510fb60776db0fa131bf48c5c79e9f2f3af125d