---
title: "Tech Tip #3: Measure before and after, on the same setup (video)"
description: "If you didn't measure it twice, you didn't save it."
url: https://greencode.ai/shorts/3-measure-before-and-after/
---

# Tech Tip #3: Measure before and after, on the same setup (video)

## Tech Tip #3: Measure before and after, on the same setup

**If you didn't measure it twice, you didn't save it.**

[Watch the video](https://media.greencode.ai/shorts/measure-before-and-after-f4f88e93ed01.mp4)

Video created by [explainapaper.com](https://explainapaper.com/?utm_source=greencode.ai&utm_medium=film&utm_campaign=made-by)

### The problem

Teams make code faster and call it greener, but speed and energy do not always move together. In GreenCode research, the GPU energy of a widely used AI inference engine fell by 4.7% while its speed rose by only 3%.

### The fix you can use today

- Measure energy before you change anything.
- Measure again after every change, on the same machines under the same load.
- Keep a change only if it saves energy and nothing else got worse.

GreenCode researchers measure each change before and after, and keep only the ones that save energy.

### Tools that help

- [green-languages](https://github.com/PLEnergyDev/green-languages?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode) (GreenCode researchers): a command-line tool that measures the energy of whole programs or marked sections of code, across languages
- [GreenCode Constitution profiler (profile.sh)](https://greencode-constitution.org/skill.md?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode) (GreenCode researchers): a script from the Constitution tooling that measures the energy of a command from processor counters, GPU sensors and an optional smart plug, and writes the result as JSON
- [Scaphandre](https://github.com/hubblo-org/scaphandre?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): measures the power drawn by each process on a Linux server and exports it to Prometheus and other monitoring stacks
- [CodeCarbon](https://github.com/mlco2/codecarbon?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): a Python package that estimates the energy and CO2 of a run from hardware power and regional grid intensity
- [perf (RAPL counters)](https://perfwiki.github.io/main/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode): Linux perf reads the processor's RAPL energy counters, e.g. `perf stat -e power/energy-pkg/`

### How GreenCode helps

GreenCode helps tackle this by measuring energy before any change and after every optimisation pass, on the same infrastructure under the same load. A saving only counts if quality, security and error rate did not get worse. [More on this](https://greencode.ai/feature/energy-and-cost-reduction/).

### Tags

#measurement#governance

### Sources

- [Reduced energy use (before and after, same infrastructure, same load)](https://greencode.ai/benefit/reduced-energy-use/)
- [GreenCode Constitution (Kapenekakis et al., GreenAI workshop, ECML PKDD 2026): 4.7% GPU energy on llama.cpp against a 3% speed gain; re-measure and keep only what saves](https://greencode.ai/publications/greencode-constitution-agent-principles-for-optimizing-code-and-llm-inference-en/)

### Transcript

If you didn't measure it twice, you didn't save it. Teams often make code faster, and call it greener. But faster is not always greener. In GreenCode research, the energy of a widely used AI program fell nearly five percent. Its speed rose by only three percent. Speed and energy do not always move together. Here is the fix you can use today. Measure energy before you change anything. Measure again after every change, on the same machines, under the same load. Keep a change only if it saves energy, and nothing else got worse. Many processors and graphics cards report their own energy use. So you don't have to guess. Read them using tools like GreenCode's green-languages, perf on Linux, and Scaphandre. Two numbers, before and after, are something your whole team can trust. GreenCode researchers measure each change before and after. They keep only the ones that save energy. GreenCode helps tackle this by measuring your system under the same load, before and after. A saving only counts if quality, security and error rate did not get worse. That was GreenCode Tech Tip number three. Follow for the next tip, and find more on greencode.ai/tech-tips.

[The tip in full](https://greencode.ai/tech-tips/3-measure-before-and-after/)

[« Tech Tip #2: Your cloud servers are mostly idle](https://greencode.ai/shorts/2-your-cloud-servers-are-mostly-idle/)[Tech Tip #4: Give your AI coding agent energy rules »](https://greencode.ai/shorts/4-give-your-agent-a-constitution/)

[All GreenCode Tech Tips](https://greencode.ai/tech-tips/) · [All GreenCode videos](https://greencode.ai/videos/)

#### Key Facts

- Tip **#3**
- For **CTOs and technical leads**
- Length **1:16**
- Category **Measuring energy**
![GreenCode](https://greencode.ai/wp-content/uploads/2024/12/greencode-logo-website-small-colours-2.webp)

Want this checked on your own system? Talk to the GreenCode team.

[Get in touch](https://greencode.ai/contact/)
