310 lines
18 KiB
Markdown
310 lines
18 KiB
Markdown
# Engine comparison: Servo vs WebKit vs Chromium (2026-11-12)
|
||
|
||
The question: should Nacre stay on Servo, or switch engines? Three browsers loaded the same ten sites one by one on the
|
||
user's PC, visible on their screen, while a sampler recorded RAM, CPU and GPU every second.
|
||
|
||
| | Browser | Engine |
|
||
|---|---|---|
|
||
| **Chromium** | old Python Nacre 0.2.1 (`~/.local/bin/nacre`, PyInstaller) | Qt WebEngine 6 = Chromium 140.0.7339 |
|
||
| **Servo** | Nacre (this repo, `main` at `ac5eeef`, MSE build) | Servo 0.7 |
|
||
| **WebKit** | `tools/engine-test/webkit_shell.py`, a bare GTK 4 window with one tab per page | WebKitGTK 6.0 2.54.2 |
|
||
|
||
## Headline
|
||
|
||
| All 10 tabs open | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| RAM (PSS of every process) | 3320 MB | **2010 MB** | 2990 MB |
|
||
| Empty browser at start | 556 MB | **139 MB** | 175 MB |
|
||
| CPU time for the whole run | 112 core-s | **62 core-s** | 61 core-s |
|
||
| Peak CPU | 254 % | **125 %** | 158 % |
|
||
| CPU at idle (60 s, all tabs) | 3.8 % | **1.0 %** | 4.4 % |
|
||
| VRAM | 434 MB | **209 MB** | 866 MB |
|
||
| Processes | 16 | 1 | 74 |
|
||
| Sites that work (of 10, judged against Chromium) | 9–10 | 6–7 | 5–6 (4 tabs blank, see caveats) |
|
||
|
||
Servo uses about 40 % less RAM than Chromium with all ten tabs open, half the CPU time and half the VRAM. But some of
|
||
that saving comes from **pages it does not finish**: the YouTube video does not play and YouTube search shows no results.
|
||
On the sites that work in all three engines, Servo's RAM per tab is still lower than or equal to Chromium's (see
|
||
"Per site").
|
||
|
||
WebKit had **no clear RAM advantage** over Chromium (2990 vs 3320 MB). It used the most VRAM (866 MB, growing with every
|
||
tab) and 74 processes. In this minimal shell, four of its tabs stayed blank white.
|
||
|
||
## Method
|
||
|
||
- **Machine**: Arch Linux, 4 threads, 16 GB RAM, AMD RX 6400 (`card1`), niri on Wayland. Every browser ran on monitor
|
||
DP-1 (1600×900) in a maximized niri column, so every window was 1556×815. The real GPU was used, with each engine's
|
||
default acceleration. One browser ran at a time, and no cargo build was running.
|
||
- **Profiles**: each browser got a throwaway `HOME` and `XDG_*` folders under its run folder. WebKit also used an
|
||
ephemeral network session. No proxy, VPN or Tor was used.
|
||
- **Same pages in every engine**: ad blocking was **off** in both Nacres (WebKit has none). Tab freezing and unloading
|
||
were off in both Nacres, so all ten tabs stayed live.
|
||
- **Steps** (`tools/engine-test/sites.txt`): each site opened in a new tab and settled for 20 s (30 s for the watch
|
||
page). Then a page check ran (document state, element count, `<video>` time), a screenshot was taken and any video
|
||
was paused. After the last site the browser idled 60 s with all tabs open, then quit. On the watch page, 10 s in, the
|
||
first video was started with `muted = true; play()` if it was paused. Muted play works in every engine without a
|
||
user gesture, and none of the three autoplayed on a fresh profile.
|
||
- **Sampler** (`tools/engine-test/sample.py`): it tracks the browser's whole process tree (every descendant, found again
|
||
each second) and records:
|
||
- **RAM**: PSS from `/proc/<pid>/smaps_rollup`, summed. Shared libraries are counted once, split across processes.
|
||
- **CPU**: utime+stime from `/proc/<pid>/stat`, in % of one core.
|
||
- **The tree's own GPU use**, from the DRM fdinfo of its processes: amdgpu gfx-engine busy %, VRAM and GTT.
|
||
- **Whole-card readings**: `gpu_busy_percent` (averaged over ten reads a second) and `mem_info_vram_used`. Other apps
|
||
were open (Discord, the Claude app), so the whole-card figures are background-polluted. The per-process DRM figures
|
||
are not.
|
||
- **Drivers**:
|
||
- Servo: a `NACRE_SCRIPT` generated by `servo_script.py`.
|
||
- Chromium: old Nacre's own `NACRE_SCRIPT` hook running `qtwebengine_driver.py`.
|
||
- WebKit: the shell's `--plan` mode.
|
||
- `run.sh <engine>` runs one browser and `analyze.py` builds the tables below.
|
||
- **Screenshots**: `docs/engine/engine-comparison/<site>.png` puts Chromium, Servo and WebKit side by side. The Servo
|
||
shots are captures of its window, taken by the selftest. The other two are `grim` captures of the whole monitor.
|
||
|
||
Rerun one engine with the command below (about 6 minutes; it opens on DP-1). Then run
|
||
`python3 tools/engine-test/analyze.py docs/engine/runs/{chromium,servo,webkit}`.
|
||
|
||
```bash
|
||
tools/engine-test/run.sh servo
|
||
```
|
||
|
||
## Does each site work? (judged against Chromium, from the screenshots and page checks)
|
||
|
||
| Site | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| 01 YouTube home | works (fresh profile: "Try searching" and the sidebar) | header and search render; the feed area is an empty box | grey skeleton cards only after 20 s |
|
||
| 02 YouTube watch | **plays** (20 s played in 20 s) | **fails**: black player and a skeleton page; the video is stuck at 4.3 s (`paused=false`, time does not advance) | blank white tab, still `loading` (not judged, see caveats) |
|
||
| 03 YouTube search | works (results, thumbnails) | **fails**: the query is in the box but no results render (1323 elements vs 5479) | blank white, `loading` (not judged) |
|
||
| 04 Discord login | page complete, but the screen is still dark at 20 s | blank, still `loading` | blank, `loading` |
|
||
| 05 Reddit | page complete (screenshot unusable) | works (feed, video posts, Google sign-in prompt) | works |
|
||
| 06 Wikipedia | page complete (screenshot unusable) | works, but **icons are black squares** (likely CSS `mask-image` icons) | works |
|
||
| 07 Google results | works | works (AI overview, results) | "unusual traffic" bot page (not judged, see caveats) |
|
||
| 08 GitHub repo | works | works | works (the file list was still a skeleton) |
|
||
| 09 DuckDuckGo results | works | works | blank white (not judged) |
|
||
| 10 BBC News | works (consent dialog) | works (consent dialog) | works (consent dialog) |
|
||
|
||
Every Servo page renders at a **larger scale** and in the **light** colour scheme, so less fits on screen (compare
|
||
GitHub and DuckDuckGo). The two Chromium-based pages render dark.
|
||
|
||
## Caveats (read before using the numbers)
|
||
|
||
- **The Chromium run overlapped a second old-Nacre.** During the run, a `~/.local/bin/nacre --version` call I made to
|
||
read the version started a full second instance on the user's own profile. It ran from about site 02 to site 08,
|
||
when I killed it.
|
||
- The sampler counts only the test browser's process tree, so **Chromium's RAM is not affected**. Its CPU may be
|
||
somewhat inflated for sites 02–07 because two browsers competed for the CPU.
|
||
- The Chromium screenshots for 02, 05 and 06 showed the other window, the user's desktop or private chats. Shot 02 is
|
||
replaced by a clean rerun; 05 and 06 are left out.
|
||
- A clean rerun of sites 01–03 (`runs/chromium-partial/`, cut short on request) gave 1328 / 2029 / 2317 MB, against
|
||
1438 / 1825 / 2198 MB in the main run, so the RAM figures agree within about 10 %. The video played 20 s in both.
|
||
- **WebKit's blank tabs (02, 03, 04, 09)** stayed white and `loading`. This looks like a problem with the minimal shell
|
||
or its compositing (for example, a `Gtk.Notebook` page that is not on screen, or the shell's single network session).
|
||
It is **not** judged as WebKit failing YouTube or DuckDuckGo: Epiphany or a proper WebKit browser may well render
|
||
them.
|
||
- **WebKit's Google page** was Google's "unusual traffic" check. That came from the IP's rate limit after several runs
|
||
in a row (WebKit ran last), not from the engine. The user's IP is blacked out in the screenshot.
|
||
- **WebKit's resources grow per tab.** VRAM went from 202 MB with one tab to 866 MB with ten (Chromium: 434 MB, Servo:
|
||
209 MB), and it ran 74 processes (web processes, network process, sandbox helpers). That is a real cost of its
|
||
process model, but the shell has no tab discarding.
|
||
- **Servo does less work where it fails.** On YouTube its DOM is half to a quarter of Chromium's (1383 vs 2307 elements
|
||
on home, 2075 vs 4880 on watch, 1323 vs 5479 on search). Its low CPU on those tabs (3 % settled on watch, against
|
||
76 % for Chromium) means a stalled page, not efficiency.
|
||
- **One run per engine** on live sites, which change between runs (ads, banners, A/B tests). Treat differences under
|
||
about 10–15 % as noise.
|
||
- **Background apps**: Discord (Electron, about 85 % of a core while visible) and the Claude app were running. They
|
||
are not in any browser's tree, but they share the CPU and GPU. The whole-card GPU baseline without a browser was
|
||
9–16 %.
|
||
- **Chromium is the old Nacre, not plain Chromium**: Qt WebEngine plus Nacre's Python UI. Its 556 MB at start includes
|
||
the Python/Qt UI and its new tab page. The WebKit shell has almost no UI.
|
||
|
||
## Per site (from `tools/engine-test/analyze.py`)
|
||
|
||
|
||
### PSS after settle, MB (growth over the previous step)
|
||
|
||
| Site | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| 01-yt-home | 1438 (+882) | 486 (+347) | 662 (+486) |
|
||
| 02-yt-watch | 1825 (+387) | 726 (+241) | 943 (+281) |
|
||
| 03-yt-search | 2198 (+373) | 925 (+198) | 1116 (+173) |
|
||
| 04-discord | 2572 (+375) | 1312 (+387) | 1556 (+440) |
|
||
| 05-reddit | 2957 (+384) | 1453 (+141) | 1867 (+311) |
|
||
| 06-wikipedia | 3082 (+126) | 1597 (+144) | 2123 (+256) |
|
||
| 07-google | 3338 (+255) | 1714 (+117) | 2199 (+76) |
|
||
| 08-github | 3097 (+-241) | 1817 (+103) | 2508 (+309) |
|
||
| 09-ddg | 3194 (+97) | 1903 (+86) | 2681 (+173) |
|
||
| 10-bbc | 3320 (+126) | 2010 (+107) | 2990 (+309) |
|
||
|
||
### Peak CPU while loading, % of one core
|
||
|
||
| Site | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| 01-yt-home | 254 | 93 | 85 |
|
||
| 02-yt-watch | 191 | 88 | 122 |
|
||
| 03-yt-search | 163 | 93 | 67 |
|
||
| 04-discord | 141 | 106 | 158 |
|
||
| 05-reddit | 169 | 70 | 149 |
|
||
| 06-wikipedia | 66 | 115 | 70 |
|
||
| 07-google | 87 | 67 | 34 |
|
||
| 08-github | 177 | 64 | 154 |
|
||
| 09-ddg | 208 | 102 | 72 |
|
||
| 10-bbc | 129 | 71 | 100 |
|
||
|
||
### Mean CPU over the last 10 s of the settle, % of one core
|
||
|
||
| Site | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| 01-yt-home | 106.4 | 50.0 | 21.9 |
|
||
| 02-yt-watch | 76.3 | 2.9 | 33.9 |
|
||
| 03-yt-search | 5.9 | 2.0 | 12.5 |
|
||
| 04-discord | 48.9 | 26.4 | 12.3 |
|
||
| 05-reddit | 43.5 | 20.0 | 34.2 |
|
||
| 06-wikipedia | 12.8 | 68.7 | 34.8 |
|
||
| 07-google | 19.2 | 20.2 | 5.0 |
|
||
| 08-github | 14.3 | 13.4 | 43.2 |
|
||
| 09-ddg | 4.8 | 1.2 | 23.9 |
|
||
| 10-bbc | 24.0 | 30.5 | 57.3 |
|
||
|
||
### Browser's own GPU (gfx engine busy, mean over the settle), %
|
||
|
||
| Site | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| 01-yt-home | 3.6 | 2.1 | 0.2 |
|
||
| 02-yt-watch | 7.7 | 1.1 | 0.0 |
|
||
| 03-yt-search | 1.3 | 1.1 | 0.0 |
|
||
| 04-discord | 2.1 | 2.3 | 0.0 |
|
||
| 05-reddit | 3.1 | 2.4 | 4.3 |
|
||
| 06-wikipedia | 1.9 | 3.1 | 1.1 |
|
||
| 07-google | 0.7 | 1.5 | 0.0 |
|
||
| 08-github | 3.4 | 1.8 | 1.2 |
|
||
| 09-ddg | 3.0 | 1.7 | 0.7 |
|
||
| 10-bbc | 4.1 | 1.2 | 1.6 |
|
||
|
||
### Browser's VRAM after settle, MB
|
||
|
||
| Site | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| 01-yt-home | 167 | 136 | 202 |
|
||
| 02-yt-watch | 201 | 172 | 172 |
|
||
| 03-yt-search | 230 | 168 | 189 |
|
||
| 04-discord | 229 | 166 | 235 |
|
||
| 05-reddit | 329 | 184 | 394 |
|
||
| 06-wikipedia | 322 | 181 | 501 |
|
||
| 07-google | 363 | 186 | 570 |
|
||
| 08-github | 399 | 188 | 691 |
|
||
| 09-ddg | 412 | 213 | 746 |
|
||
| 10-bbc | 434 | 209 | 866 |
|
||
|
||
### Page check at the end of the settle
|
||
|
||
| Site | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| 01-yt-home | complete, 2307 el | complete, 1383 el | complete, 1219 el |
|
||
| 02-yt-watch | complete, 4880 el, video 20 s | complete, 2075 el, video 4 s | loading, 246 el |
|
||
| 03-yt-search | complete, 5479 el, video 0 s | complete, 1323 el | loading, 47 el, no title |
|
||
| 04-discord | complete, 1152 el | loading, 1073 el | loading, 1072 el |
|
||
| 05-reddit | complete, 3238 el | interactive, 1217 el | interactive, 1366 el |
|
||
| 06-wikipedia | complete, 4676 el | complete, 4607 el | interactive, 4180 el |
|
||
| 07-google | complete, 3434 el | complete, 3574 el | interactive, 37 el |
|
||
| 08-github | complete, 2779 el | complete, 2405 el | interactive, 2404 el |
|
||
| 09-ddg | complete, 1218 el | complete, 1154 el | interactive, 89 el |
|
||
| 10-bbc | complete, 1391 el | complete, 1352 el | complete, 1400 el |
|
||
|
||
### Totals
|
||
|
||
| | Chromium | Servo | WebKit |
|
||
|---|---|---|---|
|
||
| PSS of the started browser before the first site (MB) | 556 | 139 | 175 |
|
||
| PSS, all 10 tabs open (MB) | 3320 | 2010 | 2990 |
|
||
| Processes, all tabs open | 16 | 1 | 74 |
|
||
| VRAM / GTT of the browser, all tabs open (MB) | 434 / 21 | 209 / 26 | 866 / 152 |
|
||
| PSS after 60 s idle (MB) | 3183 | 2013 | 3069 |
|
||
| Mean CPU, idle s 10-60 (% of one core) | 3.8 | 1.0 | 4.4 |
|
||
| Browser's GPU, idle s 10-60 (%) | 0.0 | 0.0 | 0.1 |
|
||
| Peak PSS (MB) | 3399 | 2014 | 3108 |
|
||
| Peak CPU (% of one core) | 254 | 125 | 158 |
|
||
| CPU time over the whole run (core-seconds) | 112 | 62 | 61 |
|
||
| Whole card busy: baseline without browser / during run (%) | 9 / 24 | 16 / 26 | 9 / 14 |
|
||
|
||
Memory per tab on the six sites that render in Servo and Chromium alike (Reddit, Wikipedia, Google, GitHub,
|
||
DuckDuckGo, BBC): Servo grew 86–144 MB per tab. Chromium grew 97–384 MB per tab, except at GitHub, where its total fell by 241 MB because other renderers
|
||
released memory. Servo's per-tab growth is about equal to or below Chromium's, so its RAM lead does
|
||
not come only from the YouTube pages it fails to finish. It also comes from its lower base: 139 MB against 556 MB for
|
||
the empty browser, in one process.
|
||
|
||
## Screenshots
|
||
|
||
Each image shows Chromium | Servo | WebKit at the end of the settle:
|
||
[01 YouTube home](engine-comparison/01-yt-home.png) ·
|
||
[02 watch](engine-comparison/02-yt-watch.png) ·
|
||
[03 search](engine-comparison/03-yt-search.png) ·
|
||
[04 Discord](engine-comparison/04-discord.png) ·
|
||
[05 Reddit](engine-comparison/05-reddit.png) ·
|
||
[06 Wikipedia](engine-comparison/06-wikipedia.png) ·
|
||
[07 Google](engine-comparison/07-google.png) ·
|
||
[08 GitHub](engine-comparison/08-github.png) ·
|
||
[09 DuckDuckGo](engine-comparison/09-ddg.png) ·
|
||
[10 BBC](engine-comparison/10-bbc.png)
|
||
|
||
Raw data: `docs/engine/runs/<engine>/samples.csv` (one row per second, `mark` = phase), `check-<site>.json`, and the
|
||
logs (Servo also has `selftest.log` and `script.txt`).
|
||
|
||
## Conclusions
|
||
|
||
1. **Servo's resource advantage is real and large.** All ten tabs take 2.0 GB, against 3.3 GB for Chromium and 3.0 GB
|
||
for WebKit. The empty browser takes 139 MB, against 556 MB for the old Nacre. It used half the CPU time and half
|
||
the VRAM, idled at 1 % CPU, and runs as one process. This is the "lighter RAM" goal, and it holds on pages that
|
||
work.
|
||
2. **Servo's compatibility gap is concentrated in YouTube.** The watch page does not play and search shows no results.
|
||
Discord did not finish in 20 s in any engine, so that test is inconclusive. Reddit, Wikipedia, Google, GitHub,
|
||
DuckDuckGo and BBC render about as Chromium does: content complete, with visual differences.
|
||
3. **WebKit shows no resource reason to switch.** Its RAM is close to Chromium's, its VRAM and process count are the
|
||
highest, and its idle CPU is the highest. Its compatibility could not be judged fairly in a bare shell: four blank
|
||
tabs, and the Google rate limit. Switching to WebKit would cost the Rust/Servo codebase and gain little measurable
|
||
lightness.
|
||
4. **Chromium is the compatibility bar** (every site works), and it costs about 1.3 GB more for ten tabs, plus about
|
||
2× the CPU.
|
||
|
||
## What Servo needs to reach parity on these sites
|
||
|
||
In order of impact, each with the evidence from this run:
|
||
|
||
1. **YouTube playback through MSE**: the video starts (`readyState 4`, 854 px wide) and then stalls at 4.3 s with a
|
||
black player. Look at the media pipeline (S029 video work) and why buffering stops after the first appended
|
||
segments: the gst-mse append and seek path, and `timeupdate`.
|
||
2. **YouTube search results**: the results page builds about a quarter of Chromium's DOM and renders nothing below the
|
||
search box. Most likely a JS or web-component feature that YouTube's Polymer/Lit code depends on fails. Next step:
|
||
capture the console errors on that page.
|
||
3. **YouTube home feed and watch page layout**: they stay as skeletons for the same reason as item 2.
|
||
4. **Icons drawn through CSS masks** (Wikipedia's black squares): `mask-image` / `-webkit-mask` support with SVG.
|
||
5. **Discord**: rerun with a longer settle (60 s) before judging. None of the three engines showed the login form at
|
||
20 s.
|
||
6. **Page scale and colour scheme**: Servo pages render larger and light while the others render dark. Check the
|
||
default zoom or device pixel ratio and `prefers-color-scheme` in Nacre (not engine work, but it affects any
|
||
side-by-side comparison).
|
||
|
||
Not measured here: time to first paint and to load complete, scrolling smoothness, memory after hours of use, logged-in
|
||
sites, and repeat runs for variance.
|
||
|
||
## Nacre itself on the tune sites (S052, 2026-11-14)
|
||
|
||
`tools/mem-run.sh` runs `tests/smoke/tune-mem.txt` (the six `tune-sites.txt` tabs, 60 s idle at the end) in Nacre's
|
||
hidden nested session while `sample.py` samples the whole process tree. Data: `docs/engine/tune/nacre/<variant>/samples.csv`.
|
||
Software GL (llvmpipe) here, so VRAM is not comparable; PSS and CPU are. Runs differ by about ±150 MB and the idle CPU
|
||
by several points (YouTube's player), so read these as one sample each.
|
||
|
||
| Run (PSS of the tree, idle, median) | PSS (MB) | Idle CPU (% core) | Processes |
|
||
|---|---|---|---|
|
||
| webkit_shell, `base` (tune) | 2989 | 13.8 | 50 |
|
||
| webkit_shell, `mem500` (tune) | 2452 | 20.2 | 50 |
|
||
| webkit_shell, `no-page-cache` (tune) | 2337 | 33.8 | 50 |
|
||
| **Nacre, defaults** (page cache off, 500 MB, DocumentBrowser) | 3092 | 23.1 | 57 |
|
||
| Nacre, defaults, second run (breakdown below) | 3020 | 14.0 | 57 |
|
||
| Nacre, page cache on | 2943 | 4.6 | 57 |
|
||
| Nacre, cache model DocumentViewer | 2944 | 4.9 | 57 |
|
||
|
||
Nacre is about 600–700 MB above the shell's `no-page-cache` row. Breakdown at idle (3005 MB): six web processes 2.16 GB
|
||
(YouTube watch 620, results 420, Discord 374, home 372, Reddit 369, DuckDuckGo 325), Nacre's own process 272 MB (egui,
|
||
GTK, the bridge, stores), network process 67 MB, two small helper web processes. The web processes dominate; Nacre
|
||
adds the host (272 MB) and the web process extension plus two helper processes. The tune shell had no extension, no
|
||
ad-blocker filters and a bare GTK window. The default is not lower than the page-cache-on and viewer runs here, so the
|
||
spread between variants is noise: the D-040 savings (~115 MB for page cache off) are not visible at this sample size.
|