Performance Testing with Browser Metrics
Collect real browser performance metrics to catch slow pages, memory leaks, and layout thrashing before users do.
Performance bugs are invisible until they're not. A page loads in 500ms on your machine but takes 8 seconds on a real user's connection. A memory leak crashes the tab after 20 minutes of use. Certyn's get_performance_metrics tool gives AI agents access to the same metrics Chrome tracks internally.
How It Works
The agent enables Chrome's Performance domain, collects a snapshot of all tracked metrics, then disables it. The result is a set of key numbers that reveal how the page is actually performing — not how it looks, but how it behaves.
Key Metrics
Page load
- Documents — number of documents (frames) in the page
- Nodes — total DOM node count (high counts = slow rendering)
- FirstContentfulPaint — time until the user sees meaningful content
Rendering
- LayoutCount — how many times the browser recalculated layout
- LayoutDuration — total time spent on layout (in seconds)
- RecalcStyleCount — number of style recalculations
- RecalcStyleDuration — total time spent recalculating styles
JavaScript
- ScriptDuration — total time spent executing JavaScript
- TaskDuration — total time spent on all browser tasks
Memory
- JSHeapUsedSize — current JavaScript heap usage (MB)
- JSHeapTotalSize — total allocated heap (MB)
What to Test
Page load performance
Collect metrics after navigating to a page. Check:
- Is
FirstContentfulPaintunder 1.8 seconds? - Is the DOM node count reasonable (under 1,500 for most pages)?
- Is
ScriptDurationunder 1 second?
Interaction performance
Collect metrics before and after an interaction. Compare:
- Did
LayoutCountspike? (layout thrashing) - Did
JSHeapUsedSizegrow significantly? (potential memory leak) - Is
TaskDurationreasonable for the action?
Memory leaks
Repeat an action multiple times and check JSHeapUsedSize after each:
- Open and close a modal 10 times — does memory grow?
- Navigate between pages — does the heap keep increasing?
- Add and remove list items — is memory reclaimed?
Example Scenarios
Baseline page performance
"Navigate to the dashboard and get performance metrics. Check if FirstContentfulPaint is under 2 seconds and DOM node count is under 1500."
Test after heavy interaction
"Open the data table, sort by each column, apply 3 filters, then get performance metrics. Check if LayoutCount is reasonable and JSHeapUsedSize hasn't grown excessively."
Slow network performance
Combine with simulate_network for realistic conditions:
"Simulate a 3G network, navigate to the homepage, wait for it to fully load, then get performance metrics. Is FirstContentfulPaint under 5 seconds on 3G?"
Memory leak detection
"Navigate to the chat page. Get performance metrics (baseline). Send 50 messages. Get performance metrics again. Compare JSHeapUsedSize — it should not have grown by more than 20%."
Tips
- Collect metrics at natural checkpoints: after page load, after user actions, after idle periods
- Compare metrics across runs rather than relying on absolute thresholds
- Combine with network simulation to test under realistic conditions
- High
LayoutCountrelative to user actions usually indicates layout thrashing — a common performance problem - DOM node counts over 1,500 can slow down every interaction on the page
