🌿 GreenCheck - Sustainable Code Analysis for VS Code
GreenCheck helps you measure your code’s runtime, energy consumption, and memory usage, translating the results into real-world equivalents like CO₂ emissions, smartphone charges, and driving distances. Optimize your code for sustainability right inside VS Code!
✨ Features
- ✅ Analyze staged Git files for sustainability metrics
- ✅ Get green ratings for runtime, energy, and memory usage
- ✅ Estimate real-world impact (CO₂ emissions, phone charges, car distance)
- ✅ Simple & intuitive: Just stage your code and run
"GreenCheck: Analyze Staged Files"
Example Output
📂 Analyzing File: test.js
⚡ Running EnergiBridge for energy and memory measurement...
⏱ Running Hyperfine for runtime measurement...
=========================================
📊 Performance Summary
=========================================
⏳ Mean Runtime: 0.096 seconds (🟢)
⚡ Energy Consumption: 9.511 Joules (🟢)
🖥 Peak Memory Usage: 0.343 MB (🟢)
==================================================================
🔢 Real-World Equivalents for 100000 executions per day:
==================================================================
🌍 CO₂ Emissions: 9130.44 g CO₂/day
📱 Phone Battery Charges: 63.41 full charges/day
🚗 Driving Distance Equivalent: 76.09 km/day
=========================================
📥 Installation
Get GreenCheck from the VS Code Marketplace:
Or install via terminal:
code --install-extension greencheck
✅ No additional setup required! GreenCheck comes with EnergiBridge and Hyperfine pre-bundled, so everything works out of the box.
⚙️ Extension Settings
GreenCheck provides the following configurable settings:
Setting |
Description |
Default Value |
greencheck.runsPerDay |
Estimated daily runs for real-world impact calculation |
100000 |
You can modify these settings in:
File > Preferences > Settings > Extensions > GreenCheck
Example customization:
{
"greencheck.runsPerDay": 50000
}
🚀 How to Use
- Stage your code (
git add <file>
).
- Open the Command Palette (
Ctrl+Shift+P
or Cmd+Shift+P
on Mac).
- Run:
GreenCheck: Analyze Staged Files
- View the performance report in the VS Code Output Panel.
🐛 Known Issues
- If you receive "Git extension not found", ensure you have the VS Code Git extension installed.
- Windows users: Ensure PowerShell is installed and accessible.
📌 Release Notes
0.0.2
- Second release of GreenCheck.
- Supports energy, runtime, and memory analysis.
- Provides real-world sustainability impact metrics.
- Ensures better integration with EnergiBridge.
Enjoy coding sustainably! 🌱✨