Tech Tip #15: Even tuned code has energy left in it

An AI agent found savings in code experts already optimised.

Video created by explainapaper.com

The problem

It is tempting to assume mature, heavily optimised projects have nothing left to give. GreenCode research still found 4.7% GPU energy in llama.cpp and 28.4% in FFmpeg's 4K transcoding.

The fix you can use today

  • Measure mature code before assuming it is already efficient.
  • Look at the hot paths under your real workload, not the benchmark the project tunes for.
  • Upstream what you find so everyone running the code saves.

GreenCode researchers found that an AI agent could still save energy in code that experts had already tuned.

Tools that help

  • GreenCode Constitution skill (GreenCode researchers): open-source energy principles and a catalogue of 37 energy anti-patterns that an AI coding agent can follow to find and fix waste like this
  • GreenCode Constitution profiler (profile.sh) (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
  • green-languages (GreenCode researchers): a command-line tool that measures the energy of whole programs or marked sections of code, across languages

How GreenCode helps

GreenCode helps tackle this by publishing the Constitution for any team's AI agent to follow. The agent profiles the code, fixes ranked energy anti-patterns, measures again and keeps only the changes that save energy. More on this.

Tags

#profiling#compiled-languages#video

Sources

Transcript

An AI agent found savings in code that experts had already tuned. It is tempting to think mature projects have nothing left to give. They are fast, and many experts have worked on them. But GreenCode researchers still found savings in two of them. Almost five percent of graphics card energy in a widely used AI program. And twenty-eight percent in 4K video transcoding. Here is the fix you can use today. Measure mature code before you assume it is already efficient. Use tools like GreenCode's Constitution profiler and green-languages to measure it. Look at the hot paths under your real workload. Not only the benchmark the project tunes for. GreenCode's Constitution skill can help an AI coding agent find and fix that waste. Then share what you find with the project. Everyone who runs that code then saves too. GreenCode helps tackle this by publishing the Constitution, so any team's agent can follow it. The agent profiles, fixes, measures again, and keeps only real savings. That was GreenCode Tech Tip number fifteen. Follow for the next tip, and find more on greencode.ai/tech-tips.

All GreenCode Tech Tips · All GreenCode videos

  • Tip #15
  • For Developers
  • Length 1:13
  • Category Code efficiency
GreenCode

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

Get in touch