commit typeA commit that improves performance — reduces latency, memory use, or CPU consumption — without changing the observable behaviour of the software.
perf(scope): short imperative description of what was optimised
- what specific operation was optimised (bullet 1)
- what technique or data structure change achieves the improvement (bullet 2)
- measured before/after if available (bullet 3)
Why the performance was unacceptable and what the target metric is.
Max 72 chars/line.perf(query): replace N+1 user joins with single batched DataLoader fetch
- collect all user IDs from the result set before resolving
- fetch via UserDataLoader in a single SELECT WHERE id IN (...)
- remove per-row db.findUser() calls from the GraphQL resolver loop
At 50 items the endpoint issued 51 db queries (250ms); with the loader
it issues 2 queries (12ms). Profiled under production-replica load.perf(cache): add read-through cache for product catalogue lookups
- add Redis cache layer in ProductRepository.findById with 5-minute TTL
- use cache-aside pattern: read cache first, fall through to db on miss
- add cache.invalidate() call in product update and delete handlers
Product catalogue reads were 40% of db load; the catalogue changes
rarely (< 5 writes/hour) making it an ideal cache candidate. p99 read
latency drops from 45ms to 2ms on cache hits.perf(build): enable SWC compiler in Next.js to replace Babel
- add @next/swc-* native binary for the target platform
- remove babel.config.js and @babel/preset-env no longer needed
- verify jest transform still uses babel-jest for test files only
Full rebuild time drops from 38s to 11s; hot reload from 800ms to
120ms on a 14-inch MacBook Pro M3. No behaviour changes in output.perf(images): switch to WebP with AVIF fallback via next/image
- replace <img> tags with next/image in ProductCard and HeroSection
- set sizes prop for responsive srcset generation
- add avifQuality: 60 to next.config.js image optimisation settings
LCP on the product listing page improves from 3.2s to 1.1s (Lighthouse
mobile simulation); total image payload drops from 1.8MB to 340KB.Use perf when the change is motivated by a measurable performance improvement. Include before/after metrics in the body when available. If the optimisation also changes behaviour, use feat.
git-agent automatically analyzes your changes and infers the correct commit type.
brew install gitagenthq/tap/git-agentDoes perf trigger a version bump?Should I include benchmark numbers in the commit body?Is it perf or refactor when I extract code to improve cache locality?