Discover the impact
of your code

Paste a GitHub repository URL to analyze its energy efficiency, get CO2 estimates and AI-guided eco-friendly refactorings.

Energy Class

Assesses the structural footprint and computational efficiency of the code.

AI Optimization

Detects redundant LLM model calls to reduce server-side GPU usage.

Eco-Fix Snippets

Detects wasteful code smells and proposes high-performance alternatives.

Real-Time Coding

GreenCode now lives inside VS Code

Don't wait until you're done. GreenCode assists you as you write, highlighting energy waste like a spell-checker. Optimize your code before you even save it.

ecocode-extension.tsx
for (const user of users) {
await db.orders.findMany({ where: { userId: user.id } });
}
.
const items = products.map((p) => <Card product={p} />);

GreenCode Insight

This loop can slow the server and waste battery. Do you want to apply an automatic Eco-Fix?

Feedback immediato, stress zero

Green and yellow underlines show only the patterns that matter, without noise and without interrupting your flow.

AI Quick Fix

One click on the lightbulb and GreenCode proposes a more energy-efficient refactoring, respecting your local context.

Add to VS Code
Privacy-First

Private repo? Analyze it locally.

With the CLI you analyze the project directly on your machine with local AST parsing. The server only receives report metadata (scores, files and lines), never the source.

ecocode — terminal
$ npx ecocode@latest profile-project --config ./ecocode.profile.json
⚠ Warning: the profile command runs the code locally.
✓ Scenario API startup (3/3)
✓ Scenario job notturno (3/3)
✓ Project profiling completed.
┌──────────────────────────────────────────┐
│ ⚙ DYNAMIC PROFILING RESULTS │
├──────────────────────────────────────────┤
Weighted Avg CPU: 148.2 ms
Weighted Avg Energy: 2.6764 mWh
Weighted Avg CO2: 1.18e-3 gCO2e
Scenarios: 2
└──────────────────────────────────────────┘
Tip: use --repeat 5 for stable data
Then compare baseline vs optimized version
1

Install and run

Single-file or multi-scenario project mode. Requires Node.js 18+.

2

Local analysis

The CLI runs code locally and measures user/system CPU to estimate mWh, Joules and gCO2e. With profile-project you aggregate real repo scenarios with a weighted average.

3

Premium visual report

Define scenarios in the ecocode.profile.json file, run repeated benchmarks and get a comparable number, baseline vs optimization, without uploading source to a server.

Privacy by Design — 100% local AST analysis: no line of code is sent to the server.

Benchmark Reale

Beyond theory: Dynamic Measurement.

While the linter guides you as you write, our CLI profiler puts your code to the test. Run real benchmarks to discover the physical impact of your software in milliwatt-hours. Solid data for extreme optimizations, on single files or entire project flows.

ecocode benchmark preview
$ ecocode profile-project --config ./ecocode.profile.json
Warning: the profile command runs the code locally.
Dynamic project profiling in progress...
Scenarios: 3 | Runs per scenario: 5
Weighted avg CPU: 148.20 ms
Weighted avg Energy: 2.6764 mWh
Weighted avg CO2: 1.18e-3 gCO2e

Single File Profiling

  1. Build the project if the target is TypeScript (e.g. npm run build).
  2. Choose a real entrypoint (.js/.mjs/.cjs), not an isolated utility.
  3. Run: npx ecocode@latest profile ./dist/index.js
  4. Read CPU Time, mWh and gCO2e to compare before/after optimization.

Scenario Project Profiling

  1. Crea ecocode.profile.json with the real scenarios of the repo.
  2. Imposta un weight for each scenario based on traffic/usage.
  3. Run: npx ecocode@latest profile-project --config ./ecocode.profile.json --repeat 3
  4. Use the final weighted average as the project's energy KPI.
Nota pratica: the profiler runs real code locally. Only profile safe files and repeat benchmarks (3-5 runs) to reduce statistical noise.