Skip to main content
Documentation
On this page

Markup comparison

This comparison supports one narrow claim: a semantic-first stylesheet can keep repeated visual instructions out of a component's HTML. It does not rank complete frameworks or measure a whole application.

Result #

Metric Semantic HTML + Cirth Utility-first implementation Reduction
Class names in the markup 0 77 (42 distinct) 100%
HTML, minified 239 B 1,395 B 83%
Elements 10 10 none

Measured on 7 October 2026 against Cirth 0.16.0. The repository regenerates the result with npm run benchmark and checks it with npm run check:benchmark.

Shared brief #

Both fixtures implement the same sign-in card with:

  • the same 10 HTML elements;
  • the same text and meaningful attributes;
  • a card surface;
  • light and dark colour schemes that follow the system;
  • a visible focus indicator on every control;
  • hover and pressed button states;
  • an invalid state for an empty required field;
  • an accent-coloured checkbox.

Equal element count is a fixture constraint, not a performance result. It keeps the comparison focused on how visual instructions appear in markup.

Cirth fixture #

<article>
  <h2>Sign in</h2>
  <form>
    <label>
      Email
      <input type="email" required>
    </label>
    <label>
      Password
      <input type="password" required>
    </label>
    <label>
      <input type="checkbox" checked>
      Remember me
    </label>
    <button>Sign in</button>
  </form>
</article>

Utility-style fixture #

<article class="max-w-sm rounded-xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-800 dark:bg-zinc-900">
  <h2 class="mb-6 text-2xl font-semibold text-zinc-900 dark:text-white">Sign in</h2>
  <form class="grid gap-4">
    <label class="grid gap-1.5 text-sm font-medium text-zinc-700 dark:text-zinc-300">
      Email
      <input type="email" required class="rounded-md border border-zinc-300 bg-white px-3 py-2 text-base text-zinc-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-600 user-invalid:border-red-600 dark:border-zinc-700 dark:bg-zinc-950 dark:text-white">
    </label>
    <label class="grid gap-1.5 text-sm font-medium text-zinc-700 dark:text-zinc-300">
      Password
      <input type="password" required class="rounded-md border border-zinc-300 bg-white px-3 py-2 text-base text-zinc-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-600 user-invalid:border-red-600 dark:border-zinc-700 dark:bg-zinc-950 dark:text-white">
    </label>
    <label class="flex items-center gap-2 text-sm text-zinc-700 dark:text-zinc-300">
      <input type="checkbox" checked class="size-4 accent-violet-600">
      Remember me
    </label>
    <button class="rounded-md bg-violet-600 px-4 py-2 font-medium text-white hover:bg-violet-700 active:bg-violet-800 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-600">Sign in</button>
  </form>
</article>

The Cirth project authored this fixture in a common utility-first vocabulary to meet the brief. It is not an official example from, or a critique of, a specific utility framework.

Counting method #

Class occurrences #

A class occurrence is one whitespace-separated token in a class attribute. Repeating the same token on another element counts again. The distinct-class count is reported separately.

HTML bytes #

The script encodes the fixture as UTF-8 after replacing each whitespace run with one space and removing whitespace between adjacent tags. It does not remove attributes, shorten values or alter text.

Reduction #

For each measured metric:

(utility-style value - Cirth value) / utility-style value

The result is rounded to a whole percentage.

What the comparison excludes #

The measurement excludes both stylesheets, JavaScript and build tooling. That matters:

  • Cirth's default stylesheet is downloaded even when a page uses only part of it.
  • A generated utility stylesheet can contain only the classes discovered in the project.
  • Compression affects repeated class strings and CSS differently.
  • A template component can keep a long class list in one source location, even though rendered HTML still contains each occurrence.

For those reasons, fewer HTML bytes do not guarantee fewer total transferred bytes. Measure the deployed application when transfer size is the decision.

Interpretation #

The comparison is useful when maintainers care about the amount of presentation detail carried by templates. It says little about:

  • the flexibility of a bespoke component design;
  • how quickly a team works in either model;
  • unused CSS across a complete site;
  • runtime performance;
  • accessibility outside the stated fixture;
  • long-term maintenance in a specific codebase.

Treat those as separate evaluation questions. Why Cirth summarizes the adoption tradeoffs without extending this fixture beyond what it measures.

Reproduce the measurement #

The two fixtures live in docs/benchmark/. From a checkout with dependencies installed:

npm run benchmark
npm run check:benchmark

The first command prints the current values. The second fails if fixture changes and stored results no longer agree.

When changing the comparison, preserve the shared brief and element parity. Document any new metric before presenting it as evidence.

Search documentation

Type at least two characters to search.