Performance
What a page costs to build and to load, measured against VitePress.
These numbers come from one site of 1,001 Markdown pages, built with Vuesho and with VitePress 2.0.0-alpha.21 on the same machine, each with its default theme.
Results
| Measure | Vuesho | VitePress |
|---|---|---|
| Build time | 9.5 to 10.5 s | 20.7 to 22.1 s |
| HTML of a page, gzip | 9.6 kB | 11.9 kB |
| JavaScript of a page, gzip | 99.2 kB | 77.0 kB |
| CSS of a page, gzip | 19.2 kB | 17.6 kB |
| Navigation to another page | 26 to 35 ms | 90 to 128 ms |
| Size of the output | 178 MB | 408 MB |
| Installed size | 69 MB, 56 packages | 95 MB, 105 packages |
The build takes half the time, and the output and the install are smaller. A navigation, measured from the click to the next page on screen, is faster because the sidebar only renders the folders that are open: the page has 810 elements, against 6,660 with VitePress.
The JavaScript of a page is 22 kB larger. The UI is a port of Fumadocs UI, with its sidebar, table of contents, popovers and class merging, on top of Vue. Neither site has a task longer than 50 ms while a page loads.
What a Page Loads
The first request of a page gets its HTML with the content already rendered. The browser then loads:
- The JavaScript of the app and of the layout its theme imports, which the HTML links. The other layouts aren't in the build, and the files are cached for the next pages.
- The module of the page, 3 kB gzip on the measured site.
- The data of the site: its page tree, navbar and links. It is one file per language, fetched once: 21.2 kB gzip for the 1,001 pages.
- The search dialog, 19.4 kB gzip, once the page is interactive and the browser is idle, so the first search opens at once.
The HTML doesn't contain the page tree, which is why it stays small on a large site.
A navigation loads the data and the module of the next page, about 3.3 kB gzip together. A link starts loading them when the reader hovers or focuses it.
The search index is loaded on the first search. It holds the text of every page of the language, so it grows with the site: 796 kB gzip here. A site that large can use Algolia or Orama Cloud instead.
Development
vite dev answers its first page 1.7 seconds after it is started on the measured site, most of it reading the 1,001 files. A page opened after that renders on the server in 0.1 s.
The two frameworks differ here. VitePress answers the first request in 0.4 s after its start, with an empty document that the browser renders once it has loaded the app. Vuesho sends the rendered page, as it does in production, so what you see while writing is what a reader gets.
Keeping Pages Light
The default theme loads what only some pages use with those pages: the not found page, and components like Accordions, Files, TypeTable and ImageZoom. Do the same for what you add:
import { defineAsyncComponent } from "vue";
import { defineTheme } from "vuesho/theme";
import defaultTheme from "vuesho/theme/default";
export default defineTheme({
extends: defaultTheme,
// loaded by the pages that render them
layouts: { blog: () => import("./layouts/BlogPost.vue") },
components: { Chart: defineAsyncComponent(() => import("./components/Chart.vue")) },
});A component imported directly in the theme module is part of the JavaScript of every page.