GitLab Well Architected
Cookbook navigation
Prompts / Optimize Embedded System Code

Optimize Embedded System Code

EmbeddedDeveloperOptimizationPerformanceCreateBeginner

Optimize code for memory-constrained embedded devices. Balance performance and power consumption.

For GitLab Duo

prompt

Optimize this embedded code for [DEVICE/CONSTRAINTS]:

[PASTE CODE]

Constraints:
- Memory: [SIZE]
- CPU: [SPECS]
- Power: [REQUIREMENTS]

Optimize for:
1. Memory footprint
2. Execution speed
3. Power consumption
4. Code size
5. Maintain functionality

Use the prompt

Include measured resource use and the target device's constraints. An optimization that saves memory may change timing or power use, so compare the result on the device's actual workload.