performance-profiler
Performance Profiler
Comprehensive performance analysis and optimization toolkit
Quick Commands
# CPU profiling
node --inspect app.js
chrome://inspect
# Memory profiling
node --expose-gc --trace-gc app.js
# Bundle size analysis
npx webpack-bundle-analyzer stats.json
# Runtime performance
npx lighthouse http://localhost:3000
Core Functionality
Key Features
- CPU Profiling: Identify performance hotspots
- Memory Analysis: Detect leaks and optimize usage
- Bundle Optimization: Reduce JavaScript payload
- Network Performance: API and asset loading
- Rendering Performance: DOM and React optimization
Detailed Information
For comprehensive details, see:
cat .claude/skills/performance-profiler/references/profiling-guide.md
cat .claude/skills/performance-profiler/references/optimization-techniques.md
cat .claude/skills/performance-profiler/references/metrics-explained.md
Usage Examples
Example 1: Profile Application Startup
import { PerformanceProfiler } from '@j0kz/performance-profiler';
const profiler = new PerformanceProfiler();
profiler.start('app-startup');
// Your application initialization
await app.initialize();
const metrics = profiler.stop('app-startup');
console.log(`Startup time: ${metrics.duration}ms`);
console.log(`Memory used: ${metrics.memoryUsed}MB`);
Example 2: Detect Memory Leaks
const leakDetector = profiler.createLeakDetector();
await leakDetector.baseline();
// Perform operations
await leakDetector.snapshot();
const leaks = leakDetector.analyze();
if (leaks.found) {
console.log('Potential memory leaks:', leaks.suspects);
}
Performance Metrics
Core Web Vitals
- LCP (Largest Contentful Paint): < 2.5s
- FID (First Input Delay): < 100ms
- CLS (Cumulative Layout Shift): < 0.1
Application Metrics
- Time to Interactive (TTI)
- First Contentful Paint (FCP)
- Speed Index
- Total Blocking Time (TBT)
Configuration
{
"performance-profiler": {
"targets": {
"startupTime": 1000,
"memoryLimit": "256MB",
"bundleSize": "200KB"
},
"sampling": {
"cpu": 100,
"memory": 1000
},
"reporting": {
"format": "html",
"outputDir": "./performance-reports"
}
}
}
Integration with Monitoring
// Send metrics to monitoring service
profiler.on('metric', (metric) => {
monitoring.track(metric.name, metric.value);
});
Notes
- Supports Node.js and browser environments
- Integrates with Chrome DevTools Protocol
- Can generate flamegraphs and memory snapshots
- Automated performance regression detection
More from j0kz/mcp-agents
security-first
Universal security checklist based on OWASP Top 10 for ANY project type or language. Use before deploying to production, handling sensitive data, or processing user input.
11api-integration
Master third-party API integration in ANY language with best practices and patterns. Use when connecting to external services, handling OAuth, or implementing webhooks.
7dependency-doctor
Diagnose and heal dependency issues in ANY package manager, ANY language. Use when facing version conflicts, security vulnerabilities, or dependency bloat.
5security-scanner
Comprehensive security vulnerability scanning. Use when checking for OWASP vulnerabilities, scanning for secrets/API keys, auditing dependencies for CVEs, or running pre-commit security checks.
4zero-to-hero
Go from zero knowledge to codebase expert in ANY project, ANY size, ANY language. Use when onboarding to a new codebase or trying to understand unfamiliar code.
3competitive-ads-extractor
Extracts and analyzes competitor ads from ad libraries (Facebook, LinkedIn, TikTok, Google). Use when researching competitor messaging, creative patterns, campaign strategies, or ad inspiration. Ch...
3