Optimize areas of code that consume the most time or resources
Framework question: How do you take advantage of software and architecture patterns to support your sustainability goals?
- Risk if not established
- Medium — inefficient code paths can consume unnecessary compute, memory, I/O and network resources when hotspots are not profiled and optimized.
Executive summary
Why this practice matters
Profile and optimize the code paths that consume the most time or resources, measuring resource use before and after changes rather than responding to inefficiency by simply increasing capacity.
Business impact
Assign
Accountable and responsible roles
Responsibilities are held separately from roles, so accountability type and typical roles are stated explicitly.
| Responsibility | Accountability type | Typical roles |
|---|---|---|
Profile and optimize code Identify hotspots and implement efficient algorithms and code paths. Typical roles: DevOps Engineer, DevOps Engineer | responsible | DevOps EngineerDevOps Engineer |
Guide efficiency trade-offs Ensure optimization choices fit wider architecture and performance needs. Typical roles: Architect, Architect | responsible | ArchitectArchitect |
Own outcome Ensure resource-efficiency improvements support workload objectives. Typical roles: Service Owner, Service Owner | accountable | Service OwnerService Owner |
Assessment
Assessment and evidence state
States describe how far the practice has moved from intent to something continuously validated.
- 0
Not Assessed
Code resource efficiency has not been assessed.
Indicators
- No reliable evidence is known.
- 1
Not Implemented
Code resource efficiency is largely absent or ad hoc.
Indicators
- Resource-efficiency decisions are not systematic.
- 2
Partially Implemented
Code resource efficiency exists for some scope but is inconsistent.
Indicators
- Coverage or outcome measurement is incomplete.
- 3
Implemented
Code resource efficiency is applied to material scope with explicit evidence.
Indicators
- Decisions and outcomes are traceable.
- 4
Continuously Validated
Code resource efficiency is regularly re-evaluated against measured outcomes.
Indicators
- Evidence drives continual refinement.
Assessment dimensions
Profiling coverage
Practice-specificAd hoc · Defined · Measured
Hotspot prioritization
Practice-specificLimited · Partial · Comprehensive
Benchmark rigor
Practice-specificImplicit · Documented · Validated
Regression control
Practice-specificNone · Periodic · Continuous
Standard
What you should be able to demonstrate
Statements a reviewer should be able to confirm from evidence, not from intent.
- Profiling identifies material hotspots.
- Resource use per unit of work is measured.
- Optimization targets the highest-impact code paths.
- Before/after benchmarks are retained.
- Regressions are detected in development and production.
Assess
Questions to ask
Each question exposes the difference between an intention and an operating practice.
- discovery
Which code path consumes the most resources per unit of work?
Optimization should target measured hotspots.
Usually asked by: DevOps Engineer
- evidence
Show the profiler and before/after benchmark evidence.
Optimization benefit must be demonstrable.
Usually asked by: DevOps Engineer
- challenge
Did the optimization simply shift cost or resource use elsewhere?
Local efficiency can create system-wide regressions.
Usually asked by: Architect
- measurement
How much did resource use per unit of work fall?
This is the direct efficiency outcome.
Usually asked by: Service Owner
Evidence
Required and expected evidence
Reusable evidence definitions held once in the evidence library and referenced by every practice that relies on them. Each links to what good evidence looks like and to worked examples.
Code Resource Efficiency Analysis
A profiling and benchmark record identifying code paths that consume the most CPU, memory, I/O, network or execution time, with optimization actions and measured before/after outcomes.
Provides hotspot profiling and before/after efficiency evidence.
Minimum expected content
- Component/code path
- Baseline profile
- CPU/memory/I/O/network usage
- Execution time
- Unit-of-work baseline
- Optimization hypothesis
- Change implemented
- Before/after benchmark
- Resource reduction
- Performance impact
- Owner
Anti-patterns
- Scaling infrastructure instead of profiling code
- Optimizing code with no measurable hotspot
- No before/after benchmark
- Only latency measured, not resource use
- Performance regressions not tracked
Review: Review for material performance/resource hotspots and after major code or runtime changes.
Performance Benchmark Plan & Results
A repeatable benchmark definition and result set for a workload component or architecture option, including representative scenarios, environment, metrics, repeated runs, findings and resulting architecture decisions.
Provides benchmark results.
Minimum expected content
- Benchmark objective and decision/question being informed
- Relevant performance/NFR target or user requirement
- Baseline implementation/configuration
- Candidate implementation/configuration being tested
- Representative scenario or operation mix
- Test environment and resource configuration
- Dataset/input size and pre-warm/setup conditions
- Metrics and KPIs such as latency, throughput, utilisation or error rate
- Tooling and test procedure
- Number/timing of repeated runs and observed variance
- Raw/result summary and statistical treatment appropriate to the test
- Bottlenecks or constraints identified
- Comparison with baseline and requirement
- Architecture recommendation/action resulting from the findings
- Retest result after material adjustment where applicable
- Date, owner and conditions requiring rerun
Anti-patterns
- A vendor benchmark is used as proof without matching workload characteristics
- One run is treated as conclusive
- The test environment differs materially between compared options
- Only average latency is reported for a tail-latency-sensitive workload
- Benchmarking happens with no performance requirement or decision question
- Results are cherry-picked after the preferred option is selected
- No pre-warm or variance control exists
- The benchmark is used as a substitute for load testing the complete workload when concurrency/system behaviour matters
Review: Create for material performance-sensitive architecture choices and rerun when the tested component, configuration, workload profile or performance requirement changes materially.
Architecture / Design Decision Record
A durable record of a significant technology or architecture decision showing what was decided, why it was decided, which alternatives and trade-offs were considered, what risks or consequences remain and who owns the decision.
Records material implementation trade-offs.
Minimum expected content
- Decision title, date, status and decision owner
- Problem, opportunity or context that required a decision
- Relevant business, technical, operational, security or regulatory objectives and constraints
- Options or alternatives genuinely considered
- Evaluation criteria and material trade-offs
- Decision and rationale
- Expected benefits and positive consequences
- Risks, disadvantages, technical debt and mitigation where material
- Affected systems, services or stakeholders
- Follow-up actions and owners where required
- Approval, acceptance or decision authority where relevant
- Review trigger/date and links to superseding or related decisions
Anti-patterns
- Recording only the final choice with no context or rationale
- Listing alternatives without showing how they were evaluated
- Using a decision record to retrospectively justify a decision that had already been made without challenge
- Treating every low-level implementation choice as a formal architecture decision
- Omitting known risks, disadvantages or dissenting stakeholder concerns
- No named decision owner or approval authority
- Never updating a record when the decision is superseded
- Copying a generic template without evidence specific to the actual decision
Review: Create when a material decision is made. Update status when accepted, rejected or superseded, and revisit when key assumptions, constraints, risks or business objectives materially change.
Diagnosis
Common evidence gaps
Scale instead of optimize
Capacity is increased without profiling.
No hotspot evidence
Optimization targets are chosen by intuition.
Latency-only metrics
Resource use is ignored.
No regression tracking
Efficiency degrades unnoticed over time.
Implementation
Implementation guidance
Profile hotspots
Measure CPU, memory, I/O, network and execution time.
Optimize high-impact code
Improve algorithms, language/runtime choices and unnecessary work.
Benchmark before and after
Compare resource use and performance.
Track regressions
Keep resource efficiency visible in development and operations.
Measure
Measurements
- CPU time per unit of work.
- Memory per unit of work.
- Execution time reduction.
- I/O or network reduction.
- Resource reduction from code optimization.
Related
Outcomes and practices
Business outcomes
Practices