# Link preview benchmarks

> Reproducible link preview benchmarks: linkpeek against five packages on large and small pages, install size, and how much of each page is read.

I measured linkpeek and five other link preview packages on November 15, 2026, with the same pages, the same local server and the same correctness check. The harness is open, so you can run it yourself. The pages are served locally, which means the numbers show library time without network latency ([why a live preview takes longer](#live)). Where another package is the better fit, the [library comparison](https://linkpeek.js.org/guides/link-preview-library-comparison/) says so.

- 500 kB page, vs the next-fastest package: **4.0× faster**
- Install size, vs the next-smallest package: **2.4× smaller**
- Runtime dependencies: **1**

## Large pages

Each package previews the same 500 kB page whose metadata sits in the `<head>`. linkpeek stops reading after the head and cancels the response stream, so most of the body is never read or parsed.

**500 kB page with a normal head.** Median milliseconds per end-to-end preview. Shorter is faster.

| Package | Median |
| --- | ---: |
| **linkpeek** 3.0.0 | 2.76 ms |
| unfurl.js 6.4.0 | 11.0 ms |
| link-preview-js 6.0.0 | 48.6 ms |
| url-metadata 6.3.1 | 49.5 ms |
| metascraper 5.58.6 | 62.6 ms |
| open-graph-scraper 6.13.0 | 377 ms |

## Small pages

On small pages the packages are within about two milliseconds of each other, and real network latency dominates. `unfurl.js` was faster than linkpeek on every small fixture in this run: it requests pages with `node-fetch` over Node's `http` module, while linkpeek uses the platform `fetch` so the same code runs on Bun, Deno and Workers. Among the packages measured on `fetch`, linkpeek was fastest on every page.

**Small pages (0.6 kB–2.3 kB).** Mean of the medians for 3 fixtures. Shorter is faster.

| Package | Median |
| --- | ---: |
| unfurl.js 6.4.0 | 0.80 ms |
| **linkpeek** 3.0.0 | 1.25 ms |
| link-preview-js 6.0.0 | 1.72 ms |
| open-graph-scraper 6.13.0 | 1.94 ms |
| metascraper 5.58.6 | 2.71 ms |
| url-metadata 6.3.1 | 2.89 ms |

## Install footprint

linkpeek has one runtime dependency, `htmlparser2`. A small install matters most for serverless cold starts, container images and edge bundles.

**Clean install size.** Clean npm install --ignore-scripts of the pinned published version; metascraper includes the same 7 rule packages.

| Package | node_modules |
| --- | ---: |
| **linkpeek** 3.0.0 | 1.3 MB · 7 packages |
| unfurl.js 6.4.0 | 3.2 MB · 16 packages |
| link-preview-js 6.0.0 | 7.9 MB · 18 packages |
| url-metadata 6.3.1 | 10.4 MB · 30 packages |
| open-graph-scraper 6.13.0 | 11.1 MB · 27 packages |
| metascraper 5.58.6 | 81.1 MB · 128 packages |

## Bytes read from a 500 kB page

The local stream probe serves a controlled 500 kB response in 1 kB chunks and records how much the parser requested.

| Mode | Source bytes requested | Configured ceiling | 500 kB page |
| --- | --- | --- | --- |
| **Fast** (default) | **2 kB** | 30 kB | Stops after `</head>` |
| Quality | ~202 kB | 200 kB | Continues for body fallbacks |

“Source bytes” includes one 1 kB chunk that was already queued in the stream; the retained-byte ceiling itself is exact. The figures count requested chunks, not bytes on the wire.

## Benchmarks and a live preview

These runs use a local server, so they measure the library, not the internet. A live preview also waits for the target site: DNS, the connection, TLS and the server's own response time. That wait is usually far longer than the library's work, and no parser can shorten it.

The homepage demo shows the two apart. "Site" is the time until the target's response headers arrive, summed over redirects. "Reading head" is linkpeek streaming the rest of the `<head>` and parsing it. On a real network, reading only the head still saves time on large pages, because linkpeek stops downloading after `</head>` instead of transferring the whole document.

## Method

The packages run on a local server, so these numbers isolate library overhead; they do not predict latency against real websites. Median of three runs. Each run reports the median end-to-end preview time per fixture from a local HTTP server in the same Node.js process, after 5 warmups. Every timed result must extract the expected title.

Environment: Linux x64, 2 vCPU Intel Xeon 2.20 GHz, Node.js 24.22.2, npm 11.19.1. Versions: `linkpeek@3.0.0`, `unfurl.js@6.4.0`, `link-preview-js@6.0.0`, `open-graph-scraper@6.13.0`, `url-metadata@6.3.1`, `metascraper@5.58.6`.

- `linkpeek`: Measured from the 3.0.0 source before publishing (merge commit bd1c9df); the install size is the published 2.1.7, which has the same single runtime dependency.
- `link-preview-js`: Measured as native fetch plus getPreviewFromContent(); its URL API rejects the private IP-literal benchmark host.
- `open-graph-scraper`: Measured as native fetch plus ogs({ html }); since 6.13.0 its URL API rejects non-public addresses with no opt-out.
- `metascraper`: Native fetch plus metascraper with 7 rule packages; metascraper does not fetch.

Timings depend on hardware: an earlier run on Apple silicon measured lower absolute numbers with the same ordering on the large page. The [comparison notes](https://github.com/thegruber/linkpeek/blob/main/docs/comparison.md) keep every dated result, and the [raw JSON runs](https://github.com/thegruber/linkpeek/tree/main/benchmarks/competitive/results) include commit and environment details.

## Run the benchmarks

```bash
npm ci
npm run benchmark

npm run build
cd benchmarks/competitive
npm ci
npm run bench -- --json
```

The competitive lockfile pins every compared version, and every timed preview must extract the expected title. The live benchmarks are network smoke tests, and I don't use them to compare packages.

Related: [All libraries](https://linkpeek.js.org/guides/link-preview-library-comparison/) · [vs link-preview-js](https://linkpeek.js.org/guides/link-preview-js-alternative/) · [vs open-graph-scraper](https://linkpeek.js.org/guides/open-graph-scraper-alternative/)
