Performance Optimization in Development | Budgets Guide
Performance optimization requires measurement first. Set budgets for Core Web Vitals, bundle size, and API latency. Track improvements with GitScrum tasks.
8 min read
Performance is a feature. GitScrum helps teams track performance work alongside feature development and maintain performance budgets.
Performance Mindset
Why Performance Matters
PERFORMANCE IMPACT:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β USER EXPERIENCE: β
β β
β Load time User perception β
β βββββββββββ ββββββββββββββββββββββββββββββββββββββββββ β
β 0-100ms Instant β
β 100-300ms Slight delay, acceptable β
β 300-1000ms Noticeable, still OK β
β 1-3s Sluggish, users notice β
β 3-10s Frustrating, users leave β
β >10s Unusable β
β β
β BUSINESS IMPACT: β
β β
β β’ 1 second delay = 7% conversion drop β
β β’ 53% mobile users leave if > 3 seconds β
β β’ Google ranks faster sites higher β
β β’ Slow = perceived as unreliable β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β PERFORMANCE ANTI-PATTERNS: β
β β
β β "We'll optimize later" β
β β Technical debt accumulates β
β β Harder to fix when architecture is set β
β β
β β "Premature optimization is evil" β
β β Misunderstood quote β
β β Don't micro-optimize, but design for performance β
β β
β β "It's fast on my machine" β
β β Test on real devices and connections β
β β Use performance monitoring β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Performance Budgets
Setting Budgets
DEFINING PERFORMANCE BUDGETS:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β FRONTEND BUDGETS: β
β β
β Metric Budget Current Status β
β βββββββββββββββββ ββββββββββ ββββββββ ββββββ β
β LCP (Largest Paint) < 2.5s 2.1s β
OK β
β FID (Input Delay) < 100ms 85ms β
OK β
β CLS (Layout Shift) < 0.1 0.05 β
OK β
β Bundle size (JS) < 300KB 285KB β οΈ Near limit β
β Bundle size (CSS) < 50KB 42KB β
OK β
β Total page weight < 1MB 920KB β οΈ Near limit β
β β
β API BUDGETS: β
β β
β Endpoint Budget p95 Status β
β βββββββββββββββββ ββββββββββ βββββββββ ββββββ β
β GET /api/users < 200ms 180ms β
OK β
β GET /api/projects < 300ms 420ms β Over β
β POST /api/tasks < 500ms 350ms β
OK β
β Search endpoint < 1s 1.2s β Over β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β WHEN BUDGET EXCEEDED: β
β β
β 1. Flag in CI/CD pipeline β
β 2. Create performance task in GitScrum β
β 3. Must fix before or with next release β
β 4. Review architectural impact β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Budget Enforcement
AUTOMATED BUDGET CHECKS:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β CI PIPELINE: β
β β
β Build β
β β β
β Tests β
β β β
β Performance Checks βββ GATE β
β β β
β Deploy β
β β
β PERFORMANCE CHECK OUTPUTS: β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β π Performance Budget Report ββ
β β ββ
β β Bundle Analysis: ββ
β β β
main.js: 142KB (budget: 200KB) ββ
β β β οΈ vendor.js: 185KB (budget: 150KB) +35KB OVER ββ
β β ββ
β β Lighthouse Scores: ββ
β β β
Performance: 87 (budget: 85) ββ
β β β
Accessibility: 92 (budget: 90) ββ
β β ββ
β β Status: β FAILED - vendor.js over budget ββ
β β ββ
β β Action: Review changes or update budget justification ββ
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β GITSCRUM AUTO-TASK: β
β When budget exceeded: β
β β Create task: "Performance: vendor.js over budget" β
β β Labels: performance, blocker β
β β Priority: High β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Performance Tasks
Creating Performance Stories
PERFORMANCE STORY STRUCTURE:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PERF-123: Improve Dashboard Load Time β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β As a user β
β I want the dashboard to load quickly β
β So that I can start working without waiting β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β CURRENT STATE: β
β β’ Dashboard load: 4.2 seconds β
β β’ LCP: 3.8 seconds β
β β’ User complaints: 12 in last month β
β β
β TARGET STATE: β
β β’ Dashboard load: < 2 seconds β
β β’ LCP: < 2.5 seconds β
β β
β ANALYSIS: β
β β’ Large initial bundle (450KB) β
β β’ 8 API calls on load β
β β’ Unoptimized images β
β β’ No caching β
β β
β APPROACH: β
β β Code split dashboard components β
β β Implement lazy loading β
β β Consolidate API calls β
β β Add response caching β
β β Optimize images β
β β
β ACCEPTANCE CRITERIA: β
β β Dashboard loads in < 2 seconds on 3G β
β β LCP < 2.5 seconds β
β β Lighthouse score > 85 β
β β No regression in functionality β
β β Tested on mobile devices β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Profiling First
MEASURE BEFORE OPTIMIZING:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β RULE: DON'T GUESS - MEASURE β
β β
β FRONTEND PROFILING: β
β β
β 1. Browser DevTools β Performance tab β
β β’ Record page load β
β β’ Identify long tasks β
β β’ See what's blocking render β
β β
β 2. Lighthouse β
β β’ Automated performance audit β
β β’ Specific recommendations β
β β’ Score tracking β
β β
β 3. Bundle analyzer β
β β’ What's in your bundles? β
β β’ What can be removed/split? β
β β
β BACKEND PROFILING: β
β β
β 1. APM tools (New Relic, Datadog) β
β β’ Request tracing β
β β’ Database query times β
β β’ External call latency β
β β
β 2. Database EXPLAIN β
β β’ Query execution plans β
β β’ Missing indexes β
β β’ Slow query log β
β β
β 3. Load testing β
β β’ How does it behave under load? β
β β’ Where are the bottlenecks? β
β β
β DOCUMENT FINDINGS IN GITSCRUM TASK: β
β Before optimizing, attach profiling results β
β Shows what to fix and proves the fix worked β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Common Optimizations
Quick Wins
HIGH-IMPACT OPTIMIZATIONS:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β FRONTEND: β
β β
β IMAGES: β
β β’ Use modern formats (WebP, AVIF) β
β β’ Responsive images (srcset) β
β β’ Lazy load below-fold images β
β β Often biggest win β
β β
β JAVASCRIPT: β
β β’ Code split by route β
β β’ Lazy load non-critical features β
β β’ Remove unused dependencies β
β β’ Tree shake properly β
β β
β CACHING: β
β β’ Cache static assets aggressively β
β β’ Use service workers β
β β’ Cache API responses where appropriate β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β BACKEND: β
β β
β DATABASE: β
β β’ Add missing indexes β
β β’ Optimize N+1 queries β
β β’ Use connection pooling β
β β’ Cache expensive queries β
β β
β API: β
β β’ Enable compression (gzip/brotli) β
β β’ Paginate large responses β
β β’ Use ETags for caching β
β β’ Parallelize independent calls β
β β
β INFRASTRUCTURE: β
β β’ CDN for static assets β
β β’ Geographic distribution β
β β’ Appropriate instance sizes β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Tracking Progress
Performance Dashboard
PERFORMANCE MONITORING:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PERFORMANCE DASHBOARD β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β WEB VITALS (Last 7 days) β
β β
β LCP: [ββββββββββββββββββββββββ] 2.1s β
Good β
β FID: [ββββββββββββββββββββββββ] 85ms β
Good β
β CLS: [ββββββββββββββββββββββββ] 0.05 β
Good β
β β
β TREND: β Improving β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β API RESPONSE TIMES (p95) β
β β
β Endpoint Baseline Current Change β
β βββββββββββββββββ βββββββββ ββββββββ ββββββ β
β GET /api/projects 420ms 280ms β 33% β
β POST /api/tasks 350ms 320ms β 9% β
β Search 1.2s 800ms β 33% β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β ACTIVE PERFORMANCE TASKS: β
β β
β π΄ PERF-124: Image optimization β
β π‘ PERF-125: Bundle splitting β
β π’ PERF-126: API caching (completed) β
β β
β [View all performance tasks] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ