A comprehensive tool to measure and compare real-world power consumption of different web browsers on macOS using advanced browsing simulation patterns.
This benchmark simulates realistic browsing behavior (tab switching, scrolling, searching, page reloading) while measuring precise power consumption using macOS's built-in powermetrics utility. The tool provides statistical analysis to compare browser efficiency and real-world battery life impact.
- 🤖 Advanced browser automation using AppleScript with 6 different browsing patterns
- ⚡ Precise power monitoring with CPU + GPU + ANE measurements every second
- 🌐 Active browsing simulation (tab cycling, scrolling, searching, reloading, zoom adjustments)
- 📊 Statistical analysis with mean, min, max, standard deviation, and efficiency comparisons
- 🧹 Clean test isolation between different browsers with automated cleanup
- 🔋 Battery life estimation based on actual power consumption data
The benchmark simulates six realistic browsing behaviors:
- Quick Scan - Fast scrolling through content (like skimming news)
- Detailed Read - Slower, deliberate reading with small scrolls
- Search Mode - Using Cmd+F to search within pages
- Link Navigation - Tab key navigation between clickable elements
- Page Reload - Refreshing content (common on news/social sites)
- Zoom Adjust - Changing zoom levels for better readability
- macOS (tested on macOS 12+)
- Python 3.7+
- Safari and/or Brave Browser installed
- Administrator privileges (for
powermetrics) - Pandas library for report generation
-
Setup the environment:
cd BrowserBench python -m venv .venv source .venv/bin/activate pip install pandas
-
Run the benchmark (requires sudo for power monitoring):
sudo python browser_bench.py
-
Generate detailed report:
python report.py
browser_bench.py- Enhanced benchmark script with advanced browsing patternssites.txt- List of websites to test with (customizable)report.py- Enhanced analysis and reporting tool with battery life estimatesbrowser_power_results.csv- Generated power measurement data (created after benchmark)
Recent benchmark results show significant differences in browser efficiency:
| Browser | Average Power | Min Power | Max Power | Battery Life* | Efficiency |
|---|---|---|---|---|---|
| Brave | 743 mW | 41 mW | 8,293 mW | ~67 hours | 45% better |
| Safari | 1,356 mW | 44 mW | 10,551 mW | ~37 hours | Baseline |
*Based on 50Wh battery capacity during active browsing
Customize the benchmark by editing browser_bench.py:
# Test duration settings
POWERMETRICS_DURATION_SEC = 120 # Total monitoring time
TAB_ACTIVITY_DURATION = 90 # Active browsing time
# Browser configuration
BROWSERS = {
"Safari": "safari",
"Brave": "brave-browser",
# Add more browsers here
}
# Browsing patterns (automatically rotated)
BROWSING_PATTERNS = [
"quick_scan", "detailed_read", "search_mode",
"link_navigation", "reload_page", "zoom_adjust"
]Customize test websites by editing sites.txt (one URL per line).
- 🌐 Opens multiple tabs with real websites from
sites.txt - 🎭 Simulates realistic browsing using 6 different behavioral patterns
- 📏 Monitors power consumption every second using
powermetrics - 📈 Collects statistical data over configurable test periods
- 🧮 Generates comparative analysis with efficiency calculations and battery estimates
- 🧹 Automatically cleans up browser state between tests
- AppleScript Integration: Native browser control for realistic automation
- Concurrent Processing: Browsing simulation runs parallel to power monitoring
- Pattern Rotation: Ensures variety with scheduled and random pattern selection
- Robust Error Handling: Graceful handling of automation and measurement errors
- Real-time Data Logging: CSV format with timestamps for detailed analysis
-
Add browser entry to the
BROWSERSdictionary:BROWSERS = { "Safari": "safari", "Brave": "brave-browser", "Chrome": "google-chrome", # Example "Firefox": "firefox" # Example }
-
Update the AppleScript process names in the browsing behavior functions if needed.
- Permission Issues: Ensure you run with
sudofor powermetrics access - Empty Results: Check that browsers are installed and accessible
- High CPU Usage: Normal during testing due to active browsing simulation
The benchmark results show that browser choice can significantly impact battery life:
- 45% power difference between most and least efficient browsers
- ~30 hour difference in battery life for typical usage
- Consistent patterns across different website types and usage scenarios
This data helps users make informed decisions about browser choice based on their priorities (battery life vs. features).
MIT License - Feel free to use and modify for your own browser testing needs.
Built with ❤️ for the macOS community. Contributions and improvements welcome!