Web Performance Optimization & Lighthouse · レッスン

Lighthouseによるパフォーマンス予算

パフォーマンス予算を定義・適用し、サイズとメトリクスの上限を自動的にチェックして、本番環境に到達する前にリグレッションを防ぎます。

レッスン 4/413 ステップ

「Lighthouseによるパフォーマンス予算」はCoddyKit上の無料Web Performance Optimization & Lighthouseレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはWeb Performance Optimization & Lighthouse学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Web Performance Optimization & Lighthouseコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

What Is a Performance Budget?

A performance budget is a set of agreed limits, such as max JavaScript size or a minimum LCP, that the team commits not to exceed. It turns vague goals into enforceable thresholds.

Why Budgets Matter

Without budgets, performance erodes silently as features pile on. A budget makes regressions visible and blocking, shifting performance left into development.

Two Kinds of Budgets

  • Resource budgets: byte size and request counts per type (script, image, total).
  • Timing budgets: metric thresholds like LCP, TBT, CLS.

The budget.json File

Lighthouse reads a budget.json describing resource and timing limits. It then flags any audited page that exceeds them.

[{
  "resourceSizes": [
    { "resourceType": "script", "budget": 170 },
    { "resourceType": "total", "budget": 500 }
  ]
}]

Adding Timing Budgets

Timings are listed alongside sizes. Values are in milliseconds for time metrics.

[{
  "timings": [
    { "metric": "largest-contentful-paint", "budget": 2500 },
    { "metric": "interactive", "budget": 3800 }
  ]
}]

Running with a Budget

Pass the budget file to the Lighthouse CLI. Exceeded items appear in the report's Budgets section.

lighthouse https://example.com --budget-path=./budget.json --output=json --output-path=./report.json

Enforcing in CI with LHCI

Lighthouse CI (lhci) can assert budgets and fail the build when limits are breached, so regressions never merge.

// lighthouserc.json
{
  "ci": {
    "assert": {
      "assertions": {
        "resource-summary:script:size": ["error", { "maxNumericValue": 174080 }]
      }
    }
  }
}

Warn vs Error Levels

Assertions support warn and error levels. Start new budgets as warnings to gather data, then promote to errors once the team is confident.

Setting Realistic Limits

Base budgets on current measurements plus a small margin, or on competitor benchmarks. Budgets that are impossible to meet get ignored; budgets that are too loose never fire.

Tracking Over Time

The LHCI server stores historical results so you can chart metric and size trends and tighten budgets gradually as performance improves.

Workflow Summary

  • Define resource and timing budgets.
  • Run them locally via CLI.
  • Assert them in CI with LHCI.
  • Start as warnings, then enforce as errors.

Quick Check

You want a pull request to fail automatically when the script bundle grows beyond a set size. What achieves this?

Recap

You learned to set resource and timing budgets in budget.json, run them with the Lighthouse CLI, and enforce them in CI via Lighthouse CI assertions. Start with warnings, promote to errors, and track trends to keep performance from regressing.

無料で開始

AI チューターと学ぶ Web Performance Optimization & Lighthouse — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
12
レッスン
48

よくある質問

「Lighthouseによるパフォーマンス予算」レッスンは無料ですか?

はい。「Lighthouseによるパフォーマンス予算」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Web Performance Optimization & Lighthouseコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Web Performance Optimization & Lighthouseコースには全4レッスンが含まれています。

「Lighthouseによるパフォーマンス予算」で何を学びますか?

パフォーマンス予算を定義・適用し、サイズとメトリクスの上限を自動的にチェックして、本番環境に到達する前にリグレッションを防ぎます。 ブラウザで直接実行するハンズオンコードでWeb Performance Optimization & Lighthouseを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Web Performance Optimization & Lighthouseを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのWeb Performance Optimization & Lighthouseは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「Lighthouseによるパフォーマンス予算」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このWeb Performance Optimization & Lighthouseレッスンでコードを書いて実行できますか?

はい。すべてのWeb Performance Optimization & Lighthouseレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. CLIとプログラムによるLighthouse
  2. カスタム監査とアサーション
  3. LighthouseのCI/CDへの統合
  4. Lighthouseによるパフォーマンス予算
← Web Performance Optimization & Lighthouseに戻る