# Marko

Marko scores 11 of 28 points on 14 speed features: 4/14 on first-paint levers and 7/14 on other features. Rank 20 of 23. Labels: 4 1st-party, 0 Experimental, 3 Third-party, 7 Manual.

- Version checked: marko 6.5.1, @marko/run 0.11.19 (pre-1.0), @marko/vite 6.1.14 (npm latest); the marko-books port resolves marko 6.4.15 / @marko/run 0.11.17 / @marko/vite 6.1.14
- Performance guide: [Why is Marko Fast? | Marko](https://markojs.com/docs/explanation/why-is-marko-fast)
- Issue tracker: https://github.com/marko-js/marko/issues
- Books demo port: [marko-books](https://github.com/MaxwellCohen/marko-books)

## Summary

| Feature | Group | Label | Points |
| --- | --- | --- | --- |
| [Production CSS inlining](https://framework-compare.vercel.app/features/css-inlining.md) | First-paint levers | Manual | 0 |
| [Font optimization](https://framework-compare.vercel.app/features/font-optimization.md) | First-paint levers | Third-party | 1 |
| [Image pipeline](https://framework-compare.vercel.app/features/image-pipeline.md) | First-paint levers | Third-party | 1 |
| [Data/HTML caching](https://framework-compare.vercel.app/features/caching.md) | First-paint levers | Manual | 0 |
| [Route prefetching](https://framework-compare.vercel.app/features/route-prefetching.md) | First-paint levers | Manual | 0 |
| [Streaming SSR](https://framework-compare.vercel.app/features/streaming-ssr.md) | First-paint levers | 1st-party | 2 |
| [Early Hints / preload headers](https://framework-compare.vercel.app/features/early-hints.md) | First-paint levers | Manual | 0 |
| [Islands / partial hydration / lazy slices](https://framework-compare.vercel.app/features/islands.md) | Other features | 1st-party | 2 |
| [Per-route render modes](https://framework-compare.vercel.app/features/render-modes.md) | Other features | Manual | 0 |
| [Fine-grained client reactivity](https://framework-compare.vercel.app/features/reactivity.md) | Other features | 1st-party | 2 |
| [Built-in bundle analysis](https://framework-compare.vercel.app/features/bundle-analysis.md) | Other features | Third-party | 1 |
| [Third-party script strategies](https://framework-compare.vercel.app/features/third-party-scripts.md) | Other features | Manual | 0 |
| [Portable multi-host deployment](https://framework-compare.vercel.app/features/multi-host-deployment.md) | Other features | 1st-party | 2 |
| [Service worker / offline support](https://framework-compare.vercel.app/features/service-worker.md) | Other features | Manual | 0 |

## First-paint levers

### Production CSS inlining

Label: **Manual** (0 of 2 points).

`<style>` is bundled and loaded once; no inlining option documented (Vite `?inline` would be by hand). No first-party CSS inlining documented. ([styling](https://markojs.com/docs/guide/styling))

Example of building it yourself:

You replace the layout's side-effect CSS import with a Vite `?inline` import, then write it out with `<html-style>`. The port uses the same `$!{…}` form for its theme script in `<html-script>`.

```marko
// src/routes/+layout.marko
import css from "../styles.css?inline"   // was: import "../styles.css"

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    // emitted as a literal <style> in the streamed HTML; no stylesheet <link>
    <html-style>$!{css}</html-style>
    // …
  </head>
  <body>
    <${input.content}/>
  </body>
</html>
```

Source: [Vite: disabling CSS injection](https://vite.dev/guide/features#disabling-css-injection-into-the-page)

### Font optimization

Label: **Third-party** (1 of 2 points).

No font primitive documented; self-host by hand with a community package such as Fontsource (as the `marko-books` `optimized` branch does). The Core Tags reference only shows a Google Fonts `@import` inside `<html-style>` (a raw `<style>` tag). No first-party font handling documented. ([core-tag](https://markojs.com/docs/reference/core-tag), [styling](https://markojs.com/docs/guide/styling))

Example of building it yourself:

The Books port self-hosts Geist with Fontsource. The CSS `@import` pulls the package's `@font-face` rules, and Vite copies the `.woff2` files into the build with hashed names.

```css
/* src/styles/global.css */
@import '@fontsource-variable/geist';
@import '@fontsource-variable/geist-mono';
@import 'tailwindcss';

@theme {
  --font-sans: 'Geist Variable', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono Variable', ui-monospace, monospace;
}
```

Source: [Fontsource: Install](https://fontsource.org/docs/getting-started/install)

### Image pipeline

Label: **Third-party** (1 of 2 points).

No image component or optimizer documented; the native-tag page and the full reference contain only an `og:image` meta example and plain `<img>`. `@marko/vite` rewrites static relative `<img src>` paths to hashed Vite assets but does not resize or convert. A host image CDN wired by hand is the third-party route, as for React Router and Ember. ([native-tag](https://markojs.com/docs/reference/native-tag))

Example of building it yourself:

Marko has no image component, so a small tag builds a `srcset` against the host's image CDN. This one uses Netlify Image CDN URLs; remote sources must be allowlisted in `netlify.toml`.

```marko
// src/tags/book-cover.marko
export interface Input { src: string; title: string; sizes: string; priority?: boolean }

static const WIDTHS = [160, 320, 640];
static function cdn(src: string, w: number) {
  return `/.netlify/images?url=${encodeURIComponent(src)}&w=${w}&q=75`;
}

<img
  src=cdn(input.src, 320)
  srcset=WIDTHS.map((w) => `${cdn(input.src, w)} ${w}w`).join(", ")
  sizes=input.sizes
  alt=input.title
  width=320 height=480
  loading=(input.priority ? "eager" : "lazy")
  fetchpriority=(input.priority ? "high" : undefined)
/>
```

```toml
# netlify.toml
[images]
  remote_images = ['https://images\.gr-assets\.com/.*']
```

Source: [Netlify: Image CDN overview](https://docs.netlify.com/build/image-cdn/overview/)

Art direction with `<picture>` (Manual, not scored):

All native HTML tags are supported, so `<picture>` is hand-written. No first-party image helper documented on the native-tag page or in the full reference. ([native-tag](https://markojs.com/docs/reference/native-tag))

Marko renders native tags as-is, so you write `<picture>` in a custom tag. You also produce each format and crop yourself and put them in `public/`.

```marko
// src/tags/hero-image.marko
export interface Input {
  alt: string;
  priority?: boolean;
}

<picture>
  <source media="(min-width: 1000px)" type="image/avif" srcset="/hero-wide.avif">
  <source media="(min-width: 1000px)" srcset="/hero-wide.jpg">
  <source type="image/avif" srcset="/hero-tall.avif">
  <img
    src="/hero-tall.jpg"
    alt=input.alt
    width=750
    height=1334
    decoding="async"
    fetchpriority=(input.priority ? "high" : undefined)
    loading=(input.priority ? "eager" : "lazy")
  >
</picture>
```

Source: [Marko native tags](https://markojs.com/docs/reference/native-tag)

### Data/HTML caching

Label: **Manual** (0 of 2 points).

Marko Run documents no data cache, ISR, or cache-header API. `@marko/run-adapter-static` builds the whole app into static files by crawling relative links (`urls` option for extras), with no revalidation and no per-route choice, so it does not cache a server-rendered app. Otherwise the app hand-sets `Cache-Control` on web-standard Request/Response, the same basis as Fresh. Our feature test passed only by setting `Cache-Control` by hand in the route's `GET` handler. ([adapters](https://markojs.com/docs/marko-run/adapters))

Example of building it yourself:

For a fully static site, swap in `@marko/run-adapter-static`, which crawls links at build time; `urls` adds pages the crawler can't reach. For server-rendered pages, set `Cache-Control` yourself in middleware, as the Books port does.

```ts
// vite.config.ts (static build)
import { defineConfig } from "vite";
import marko from "@marko/run/vite";
import staticAdapter from "@marko/run-adapter-static";

export default defineConfig({
  plugins: [marko({ adapter: staticAdapter({ urls: ["/about", "/1"] }) })],
});
```

```ts
// src/routes/+middleware.ts (server build)
export default async (_ctx: unknown, next: () => Promise<Response>) => {
  const response = await next();
  if (!response.headers.get("content-type")?.includes("text/html")) return response;
  const headers = new Headers(response.headers);
  headers.set("Cache-Control", "public, max-age=0, must-revalidate");
  return new Response(response.body, { status: response.status, headers });
};
```

Source: [Marko Run: Adapters](https://markojs.com/docs/marko-run/adapters)

### Route prefetching

Label: **Manual** (0 of 2 points).

No prefetch/preload API in the Marko Run docs or full reference. Lazy `load` triggers (`visible`, `idle`, `media`, events) defer a tag's JS only; that is not route prefetch. ([lazy-loading](https://markojs.com/docs/reference/lazy-loading))

Example of building it yourself:

Marko Run navigates with full documents, so a Speculation Rules block in the layout handles it. Supporting browsers prefetch same-origin links on hover; the others ignore the block.

```marko
// src/routes/+layout.marko
<head>
  // …
  <html-script type="speculationrules">
    {
      "prefetch": [{
        "where": { "and": [
          { "href_matches": "/*" },
          { "not": { "selector_matches": "[rel~=nofollow]" } }
        ]},
        "eagerness": "moderate"
      }]
    }
  </html-script>
</head>
```

Source: [MDN: speculationrules](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/speculationrules)

### Streaming SSR

Label: **1st-party** (2 of 2 points).

Streaming is the default. Marko flushes HTML up to each `<await>` and sends the rest when its promise resolves; a `<try>` with `@placeholder` opts into out-of-order streaming and shows the placeholder first. ([streaming](https://markojs.com/docs/explanation/streaming))

Example of building it yourself:

The handler passes the queries to the page as unresolved promises. Each `<await>` sits in a `<try>` with `@placeholder`, so the skeleton is sent first and the grid streams in when its promise resolves.

```ts
// src/routes/+handler.ts
export const GET = Run.GET((ctx, next) => {
  const params = parseSearchParams(ctx.search ?? {});
  return next({
    books: loadBooksPage(params),   // not awaited
    count: loadBooksCount(params),  // not awaited
  });
});
```

```marko
// src/routes/+page.marko
<try>
  <await|books|=$global.data.books>
    <book-grid books=books/>
  </await>
  <@placeholder><book-grid-skeleton/></@placeholder>
  <@catch|err|><error-state title="Can't load books" body=err.message/></@catch>
</try>
```

Source: [Marko: Streaming](https://markojs.com/docs/explanation/streaming)

### Early Hints / preload headers

Label: **Manual** (0 of 2 points).

No first-party preload `Link` headers or 103 Early Hints documented. Handlers return web-standard `Response` objects, so a `Link` header is set by hand in a `+handler` or `+middleware` file. ([file-based-routing](https://markojs.com/docs/marko-run/file-based-routing))

Example of building it yourself:

Set a `Link` header on HTML responses in the root middleware. This one preconnects to the font host. To preload a built file with a hashed name, read its URL from the Vite manifest.

```ts
// src/routes/+middleware.ts
const LINK = '<https://fonts.gstatic.com>; rel=preconnect; crossorigin';

export default async (_ctx: unknown, next: () => Promise<Response>) => {
  const response = await next();
  if (response.headers.get('content-type')?.includes('text/html')) response.headers.append('Link', LINK);
  return response;
};
```

Source: [Marko Run: file-based routing](https://markojs.com/docs/marko-run/file-based-routing)

## Other features

### Islands / partial hydration / lazy slices

Label: **1st-party** (2 of 2 points).

Zero JS by default; the compiler ships only interactive code and the client resumes instead of re-running templates; `import X from "<tag>" with { load: "visible#hero" }` defers a tag bundle. The docs describe an islands-like result without a server/client component split. ([fine-grained-bundling](https://markojs.com/docs/explanation/fine-grained-bundling), [why-is-marko-fast](https://markojs.com/docs/explanation/why-is-marko-fast), [lazy-loading](https://markojs.com/docs/reference/lazy-loading))

Example of building it yourself:

Interactive code ships by default only for tags with client state or handlers. To delay one tag's JS further, import it with a `load` trigger. The server still renders its HTML; the browser fetches the bundle when `#reviews` scrolls into view.

```marko
// src/routes/$id/+page.marko
import BookReviews from "<book-reviews>" with { load: "visible#reviews?rootMargin=200px" }

<book-detail book=$global.data.book/>

<section id="reviews">
  <BookReviews bookId=$global.data.book.id/>
</section>
```

Source: [Marko: Lazy loading](https://markojs.com/docs/reference/lazy-loading)

### Per-route render modes

Label: **Manual** (0 of 2 points).

Marko Run documents streaming SSR; the static adapter is app-wide and `+meta.*` is static metadata only. No per-route render-mode switch documented. ([file-based-routing](https://markojs.com/docs/marko-run/file-based-routing), [adapters](https://markojs.com/docs/marko-run/adapters))

Example of building it yourself:

Every route still streams SSR. You tag a route with a mode in `+meta.json`, and the root middleware turns it into CDN Cache-Control. This adapts the port's `+middleware.ts`.

```ts
// src/routes/about/+meta.json   →  { "render": "static" }
// src/routes/+meta.json         →  { "render": "isr" }

// src/routes/+middleware.ts
const cacheControl: Record<string, string> = {
  static: "public, s-maxage=31536000",                // cached until redeploy
  isr: "public, s-maxage=60, stale-while-revalidate=86400",
};

export default Run.ALL(async (ctx, next) => {
  const res = await next();
  if (!res.headers.get("content-type")?.includes("text/html")) return res;
  const mode = (ctx.meta as { render?: string } | undefined)?.render;
  const headers = new Headers(res.headers);
  headers.set("Cache-Control", cacheControl[mode ?? ""] ?? "private, no-store"); // SSR
  return new Response(res.body, { status: res.status, statusText: res.statusText, headers });
});
```

Source: [Marko Run file-based routing (+meta, +middleware)](https://markojs.com/docs/marko-run/file-based-routing)

### Fine-grained client reactivity

Label: **1st-party** (2 of 2 points).

The compiler resolves reactivity per expression; "no dependency tracking happens at runtime"; `<let>` / `<const>`. ([why-is-marko-fast](https://markojs.com/docs/explanation/why-is-marko-fast))

Example of building it yourself:

`<let>` declares state and `<const>` derives from it. The compiler works out which DOM nodes depend on `count` at build time, so there is no runtime dependency tracking.

```marko
// src/tags/counter.marko
<let/count=0>
<const/doubled=count * 2>

<button onClick() { count++ }>
  ${count} × 2 = ${doubled}
</button>
```

Source: [Marko: Why is Marko fast](https://markojs.com/docs/explanation/why-is-marko-fast)

### Built-in bundle analysis

Label: **Third-party** (1 of 2 points).

The CLI has only `dev`, `build`, `preview`; the Vite plugin options are `routesDir`, `adapter`, `trailingSlashes`. No first-party analyzer documented; Marko Run builds with Vite, so the third-party route is a community visualizer such as [rollup-plugin-visualizer](https://github.com/btd/rollup-plugin-visualizer). ([cli](https://markojs.com/docs/marko-run/cli), [vite-plugin](https://markojs.com/docs/marko-run/vite-plugin))

Example of building it yourself:

Marko Run builds with Vite, so add `rollup-plugin-visualizer` next to the Marko plugin. `marko-run build` then writes a treemap of the client bundles.

```ts
// vite.config.ts
import { defineConfig } from "vite";
import marko from "@marko/run/vite";
import { visualizer } from "rollup-plugin-visualizer";

export default defineConfig({
  plugins: [
    marko(),
    visualizer({ filename: "stats.html", gzipSize: true, brotliSize: true }),
  ],
});
```

Source: [rollup-plugin-visualizer README](https://github.com/btd/rollup-plugin-visualizer)

### Third-party script strategies

Label: **Manual** (0 of 2 points).

`<script>` is effect-like, not a loader; `<html-script>` emits a raw tag. No loading strategies documented. ([core-tag](https://markojs.com/docs/reference/core-tag))

Example of building it yourself:

Marko's `<script>` is a mount effect, so you use `<html-script>` for a literal async tag. A `<script>` effect then loads the low-priority widget at browser idle.

```marko
// src/routes/+layout.marko
<head>
  // …
  // literal tag in the HTML: downloads in parallel, never blocks parsing
  <html-script async src="https://analytics.example.com/script.js"></html-script>
</head>
<body>
  <${input.content}/>
  // runs once in the browser after mount, then waits for idle
  <script>
    (window.requestIdleCallback || setTimeout)(() => {
      const s = document.createElement("script");
      s.src = "https://widget.example.com/chat.js";
      s.async = true;
      document.head.append(s);
    });
  </script>
</body>
```

Source: [Marko core tags](https://markojs.com/docs/reference/core-tag)

### Portable multi-host deployment

Label: **1st-party** (2 of 2 points).

Official adapters for Node, Static and Netlify (Functions or Edge, needs `netlify.toml`) are on the adapters page. Cloudflare Workers (`@marko/run-adapter-cloudflare`) is announced as an official adapter in the markojs.com [October 2026 newsletter](https://markojs.com/docs/newsletter/october-2026) but is not yet on the adapters page. `@marko/run-adapter-vercel` (npm 0.1.1) is published from the `marko-js/run` repository by the same maintainers as `@marko/run` and is documented only in its repo README, not on markojs.com. None is labeled experimental. The `marko-books` port deploys with all three. ([adapters](https://markojs.com/docs/marko-run/adapters))

Example of building it yourself:

The Books port picks an adapter at build time from an env var. The default Node adapter covers local and container runs; the Netlify, Vercel and Cloudflare adapters build for each host.

```ts
// vite.config.ts
import { defineConfig } from "vite";
import marko from "@marko/run/vite";

export default defineConfig(async () => {
  const adapter = process.env.CLOUDFLARE
    ? (await import("@marko/run-adapter-cloudflare")).default()
    : process.env.NETLIFY
      ? (await import("@marko/run-adapter-netlify")).default() // { edge: true } for Edge Functions
      : process.env.VERCEL
        ? (await import("@marko/run-adapter-vercel")).default()
        : (await import("@marko/run/adapter")).default();

  return { plugins: [marko({ adapter })] };
});
```

```sh
NETLIFY=1 marko-run build && netlify deploy --prod --no-build
```

Source: [Marko Run: Adapters](https://markojs.com/docs/marko-run/adapters)

### Service worker / offline support

Label: **Manual** (0 of 2 points).

No service worker support documented in the Marko or Marko Run docs. Hand-write the worker, serve it as a static file, and register it from a `<script>`. ([file-based-routing](https://markojs.com/docs/marko-run/file-based-routing))

Example of building it yourself:

Put a hand-written worker in `public/` and register it with an inline script in the root layout.

```js
// public/sw.js
const CACHE = 'books-v1'; // change the name on each deploy

self.addEventListener('activate', (event) => {
  event.waitUntil(
    caches.keys().then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))),
  );
});

self.addEventListener('fetch', (event) => {
  const { request } = event;
  if (request.method !== 'GET' || new URL(request.url).origin !== location.origin) return;
  // Network first, so pages stay current. The cached copy answers when offline.
  event.respondWith(
    fetch(request)
      .then((response) => {
        const copy = response.clone();
        caches.open(CACHE).then((cache) => cache.put(request, copy));
        return response;
      })
      .catch(() => caches.match(request)),
  );
});
```

```marko
// src/routes/+layout.marko
static const SW_SCRIPT = `if('serviceWorker' in navigator)addEventListener('load',function(){navigator.serviceWorker.register('/sw.js')});`;
// … in <head>
    <html-script>$!{SW_SCRIPT}</html-script>
```

Source: [Using Service Workers (MDN)](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API/Using_Service_Workers)

## Other performance features

- Lazy `load` triggers; automatic fine-grained bundling; CSP nonce support (`$global.cspNonce`). ([lazy-loading](https://markojs.com/docs/reference/lazy-loading), [fine-grained-bundling](https://markojs.com/docs/explanation/fine-grained-bundling), [template](https://markojs.com/docs/reference/template))

## Deployments of the Books demo

| Branch | Note | Vercel | Netlify | Cloudflare |
| --- | --- | --- | --- | --- |
| `main` | vibe port | https://marko-books.vercel.app | https://marko-books.netlify.app | https://marko-books.to-email-max.workers.dev |
| `optimized` | cache + fonts | https://marko-books-optimized.vercel.app | https://marko-books-max-optimized.netlify.app | https://marko-books-optimized.to-email-max.workers.dev |

## Benchmark, 2026-11-28

Tool: PageSpeed Insights v5 (Lighthouse lab run), mobile strategy. 3 measured runs per deployment, median reported; cold runs are left out of the median when a warm run exists. Each build's figure is the average of its hosts' medians (vercel, netlify, cloudflare). Pages measured: book list (/) and one book (/10145787). Times are lab values from one run on 2026-11-28. FCP is the Lighthouse estimate for simulated Slow 4G; Raw FCP, where shown, is the first paint in the real, unthrottled load that estimate is built from. Builds in the same FCP band (https://framework-compare.vercel.app/measured.md) are a tie, so read "fastest first" as band order.

| Page | Build | Branch | Hosts | Performance | FCP | Raw FCP | LCP | TBT | CLS |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| book list (/) | baseline | `main` | cloudflare, netlify, vercel | 85 | 1.51 s | 0.97 s | 4.26 s | 0 ms | 0.000 |
| book list (/) | optimized | `optimized` | cloudflare, netlify, vercel | 92 | 0.96 s | 0.93 s | 3.35 s | 0 ms | 0.000 |
| one book (/10145787) | baseline | `main` | cloudflare, netlify, vercel | 97 | 1.51 s | 0.60 s | 2.57 s | 0 ms | 0.000 |
| one book (/10145787) | optimized | `optimized` | cloudflare, netlify, vercel | 99 | 0.92 s | 1.37 s | 1.77 s | 0 ms | 0.000 |

Full run: https://framework-compare.vercel.app/benchmark.md

---

HTML version: https://framework-compare.vercel.app/frameworks/marko · All pages: https://framework-compare.vercel.app/llms.txt · Data: https://framework-compare.vercel.app/api/index.json
