Performance Budget
Performance budget adalah batasan yang kita tetapkan untuk metrik performance website. Tanpa budget, performance cenderung memburuk seiring waktu karena fitur terus ditambahkan.
Jenis Performance Budget
- Quantity-based — Max total JS: 300KB, max gambar: 1.5MB, max request: 50
- Time-based — LCP < 2.5s, TTI < 5s, Speed Index < 3s
- Rule-based — Lighthouse score ≥ 90, CLS < 0.1
Menentukan Budget
Rumus sederhana: lihat competitor tercepatmu, lalu targetkan 20% lebih cepat. Atau mulai dari baseline site yang ada, lalu kurangi 10-20% setiap quarter.
Enforce Budget
Budget hanya berguna jika di-enforce. Gunakan tools seperti:
// webpack.config.js — performance hints
module.exports = {
performance: {
maxAssetSize: 250000, // 250KB per file
maxEntrypointSize: 500000, // 500KB total entrypoint
hints: "error" // build gagal jika melebihi
}
};