astro-speed-measurev0.4.0

CASOON Open Source

See where your Astro build spends its time.

astro-speed-measure wraps the hooks of your integrations and Vite plugins, adds up the time per page, asset and content collection, and prints a report when the build is done. The report next to this text comes from building this site.

npm install @casoon/astro-speed-measure
pnpm add @casoon/astro-speed-measure
MITnpm 0.4.0Astro 5 · 6 · 7Node ≥ 22.12
astro build · this site (excerpt)
╔══════════════════════════════════════════════════════════════╗
║  ASTRO SPEED MEASURE - Build Performance Report              ║
╠══════════════════════════════════════════════════════════════╣
║  Total Build Time: 776ms                                     ║
╚══════════════════════════════════════════════════════════════╝

INTEGRATIONS
────────────────────────────────────────────────────────────────
  @casoon/pages-theme          <1ms  ░░░░░░░░░░░░░░░░░░░░  0%

VITE PLUGINS
────────────────────────────────────────────────────────────────
  astro:session-provider       74ms  ██░░░░░░░░░░░░░░░░░░  10%
  astro:routes                 44ms  █░░░░░░░░░░░░░░░░░░░  6%
  vite:import-analysis         25ms  █░░░░░░░░░░░░░░░░░░░  3%
  vite:css-post                22ms  █░░░░░░░░░░░░░░░░░░░  3%
  astro:assets                 14ms  ░░░░░░░░░░░░░░░░░░░░  2%
  astro:server-islands          8ms  ░░░░░░░░░░░░░░░░░░░░  1%
  builtin:vite-json             4ms  ░░░░░░░░░░░░░░░░░░░░  0%
  casoon-pages-virtual          2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  astro:scripts:page-ssr        2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  builtin:oxc-runtime           2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:asset                    2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  astro:head-metadata           2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:build-import-analysis      1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:oxc                     <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:terser                  <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  alias                        <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:client-inject           <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:pre-alias               <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:optimized-deps          <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
to build this site, measured on 2026-09-13
0.78 s
Vite plugins timed in that build
19
Vite hooks wrapped per plugin
4
runtime dependency (picocolors)
1

What it does

  1. Integration hooks

    Every hook of every integration in your config is wrapped in place and timed, including closures that hooks share, as <code>@astrojs/mdx</code> needs.

  2. Vite plugins

    <code>resolveId</code>, <code>load</code>, <code>transform</code> and <code>renderChunk</code> are timed for each plugin. The module ids of those calls feed the page, asset and content views.

  3. Pages, assets, content

    The module timings are grouped into the slowest pages, the slowest scripts, styles, fonts and images, and the time spent on each content collection.

  4. Baselines, budgets, CI

    The JSON report is kept for a comparison with the next build. Budgets warn when a limit is exceeded, and GitHub Actions gets a step summary.

The full report

All examples →
astro build
╔══════════════════════════════════════════════════════════════╗
║  ASTRO SPEED MEASURE - Build Performance Report              ║
╠══════════════════════════════════════════════════════════════╣
║  Total Build Time: 776ms                                     ║
╚══════════════════════════════════════════════════════════════╝

INTEGRATIONS
────────────────────────────────────────────────────────────────
  @casoon/pages-theme          <1ms  ░░░░░░░░░░░░░░░░░░░░  0%

VITE PLUGINS
────────────────────────────────────────────────────────────────
  astro:session-provider       74ms  ██░░░░░░░░░░░░░░░░░░  10%
  astro:routes                 44ms  █░░░░░░░░░░░░░░░░░░░  6%
  vite:import-analysis         25ms  █░░░░░░░░░░░░░░░░░░░  3%
  vite:css-post                22ms  █░░░░░░░░░░░░░░░░░░░  3%
  astro:assets                 14ms  ░░░░░░░░░░░░░░░░░░░░  2%
  astro:server-islands          8ms  ░░░░░░░░░░░░░░░░░░░░  1%
  builtin:vite-json             4ms  ░░░░░░░░░░░░░░░░░░░░  0%
  casoon-pages-virtual          2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  astro:scripts:page-ssr        2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  builtin:oxc-runtime           2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:asset                    2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  astro:head-metadata           2ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:build-import-analysis      1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:oxc                     <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:terser                  <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  alias                        <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:client-inject           <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:pre-alias               <1ms  ░░░░░░░░░░░░░░░░░░░░  0%
  vite:optimized-deps          <1ms  ░░░░░░░░░░░░░░░░░░░░  0%

PAGES (slowest first)
────────────────────────────────────────────────────────────────
  /changelog                       ssg      <1ms node_modules/.pnpm/@casoon+pages-theme@file+vendor+pages-theme_@astrojs+markdown-satteri@0.4.1_astro@7.3.2_c0319b61b9df79e09748d5dd99f309c2/node_modules/@casoon/pages-theme/routes/changelog.astro
  /404                             ssg      <1ms node_modules/.pnpm/@casoon+pages-theme@file+vendor+pages-theme_@astrojs+markdown-satteri@0.4.1_astro@7.3.2_c0319b61b9df79e09748d5dd99f309c2/node_modules/@casoon/pages-theme/routes/404.astro
  /showcase/[slug]                 ssg      <1ms node_modules/.pnpm/@casoon+pages-theme@file+vendor+pages-theme_@astrojs+markdown-satteri@0.4.1_astro@7.3.2_c0319b61b9df79e09748d5dd99f309c2/node_modules/@casoon/pages-theme/routes/showcase/[slug].astro
  /showcase                        ssg      <1ms node_modules/.pnpm/@casoon+pages-theme@file+vendor+pages-theme_@astrojs+markdown-satteri@0.4.1_astro@7.3.2_c0319b61b9df79e09748d5dd99f309c2/node_modules/@casoon/pages-theme/routes/showcase/index.astro
  /docs/[...slug]                  ssg      <1ms node_modules/.pnpm/@casoon+pages-theme@file+vendor+pages-theme_@astrojs+markdown-satteri@0.4.1_astro@7.3.2_c0319b61b9df79e09748d5dd99f309c2/node_modules/@casoon/pages-theme/routes/docs/[...slug].astro
  /                                ssg      <1ms src/pages/index.astro
  /_server-islands/[name]          ssr      <1ms _server-islands.astro
  /_image                          api      <1ms node_modules/.pnpm/astro@7.3.2_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.4_yaml@2.9.1/node_modules/astro/dist/assets/endpoint/dev.js

ASSETS (slowest first)
────────────────────────────────────────────────────────────────
  script       44ms ../session/provider.js
  script        4ms chunks/Base_DGYMDj_D.mjs
  script        1ms ../core/util.js
  script        1ms chunks/cpp_DsdAkftO.mjs
  script        1ms src/content.config.ts
  script        1ms chunks/components_DdjCqaWu.mjs
  script       <1ms chunks/ansi_BV25blRJ.mjs
  script       <1ms utils.js
  script       <1ms javascript.mjs
  script       <1ms chunks/jsx-runtime_CqFJ9I2x.mjs

CONTENT COLLECTIONS
────────────────────────────────────────────────────────────────
  runtime.js            3ms (27 entries)
  loaders               2ms (71 entries)
  utils.js             <1ms (11 entries)
  data-store.js        <1ms (27 entries)
  config.js            <1ms (27 entries)
  runtime-assets.js     <1ms (11 entries)
  consts.js            <1ms (36 entries)
  data-store-source.js     <1ms (27 entries)
  runtime              <1ms (13 entries)

Complete console report of one build of this site, captured with pnpm capture on 2026-09-13 (Darwin 27.0.0 (arm64), Node v24.11.1, Astro 7.3.2). The showcase adds the JSON report and the full build log; every CI build of this site prints a fresh report in its Actions log.

examples/build-report.ansi

Quickstart

Three steps from install to the first report. The documentation explains how to read each section.

  1. Install @casoon/astro-speed-measure next to Astro 5, 6 or 7.
  2. Add speedMeasure() to integrations, ideally as the first entry.
  3. Run astro build and read the report at the end of the log.
astro.config.mjsJavaScript
// astro.config.mjs
import { defineConfig } from 'astro/config';
import speedMeasure from '@casoon/astro-speed-measure';

export default defineConfig({
  integrations: [speedMeasure()],
});