Performance Testing
In one line
Performance testing measures speed and responsiveness — load times, latency, FPS — to ensure the app meets performance requirements.
In simple words
Performance testing measures how fast your application responds. Unlike load testing (which tests under traffic), performance testing focuses on the speed experienced by individual users.
Key metrics:
- Page load time — time from navigation to fully loaded page
- Time to Interactive (TTI) — when the page becomes interactive
- First Contentful Paint (FCP) — when first content appears
- API latency — response time for individual API calls
- Frames per second (FPS) — animation/rendering smoothness
- Core Web Vitals — LCP, FID, CLS (Google's key metrics)
Types:
- Frontend performance — page load, rendering, JavaScript execution
- Backend performance — API response time, database query speed
- Network performance — bandwidth, latency, CDN effectiveness
Tools: Lighthouse, WebPageTest, Chrome DevTools, k6, Artillery.
Process: measure baseline → set targets (e.g., LCP < 2.5s) → optimize → re-measure → iterate.
Example
// Lighthouse performance audit (Node.js)
import lighthouse from 'lighthouse';
import chromeLauncher from 'chrome-launcher';
async function runPerfAudit(url) {
const chrome = await chromeLauncher.launch();
const result = await lighthouse(url, {
port: chrome.port,
onlyCategories: ['performance'],
});
await chrome.kill();
const metrics = result.lhr.audits;
console.log({
score: result.lhr.categories.performance.score * 100,
FCP: metrics['first-contentful-paint'].numericValue, // ms
LCP: metrics['largest-contentful-paint'].numericValue, // ms
TTI: metrics['interactive'].numericValue, // ms
CLS: metrics['cumulative-layout-shift'].numericValue,
speedIndex: metrics['speed-index'].numericValue, // ms
});
// Assert thresholds
expect(metrics['largest-contentful-paint'].numericValue).toBeLessThan(2500);
expect(metrics['cumulative-layout-shift'].numericValue).toBeLessThan(0.1);
}Lighthouse measures Core Web Vitals: LCP (largest contentful paint < 2.5s), CLS (layout shift < 0.1), FID (first input delay < 100ms). These directly affect user experience and SEO ranking.
Common confusions
Confused with: load testing
The difference: Performance testing measures speed and responsiveness for individual users — page load time, API latency, rendering FPS. Load testing measures how the system handles many concurrent users. Performance testing is about speed; load testing is about capacity. You need both: fast for one user AND fast for many users.
Related terms
Related Resources
Related Lessons
- Performance Testing
Performance testing overview.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.