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

All GreenCode Tech Tips

  • Tip #15
  • For Developers
  • Category Code efficiency
  • Format short video
GreenCode

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

Get in touch