Unleash the full potential of WebGPU with comprehensive GPU profiling. Monitor GPU utilization, track memory allocation, profile shader performance, and benchmark capabilities in real-time. Build faster, smoother, and more efficient GPU-accelerated applications.
- Zero Dependencies - Works completely standalone
- Real-Time Monitoring - Track FPS, GPU utilization, memory usage
- Cross-Device Benchmarks - Compare performance across hardware
- Production-Ready - Battle-tested in GPU-intensive applications
- Privacy-First - All data stays local, no external calls
- ⚡ Why Browser GPU Profiler?
- 🚀 Features
- 📦 Installation
- ⚡ Quick Start
- 📊 How It Works
- 📖 Documentation
- 🎯 Real-World Use Cases
- 📚 Inspiring Examples
- 📚 API Reference
- 🧪 Testing
- 🔧 Development
- 🌐 Browser Support
- 🤝 Contributing
- 📄 License
- 🔗 Links
WebGPU changes everything for browser-based graphics and compute. But harnessing that power requires visibility into what's actually happening on the GPU. Browser GPU Profiler gives you that visibility.
You've built an amazing WebGPU application. It runs beautifully on your development machine. But then:
- 🐌 Users report lag and stuttering on mid-range laptops
- 🔋 Mobile battery drains faster than expected
- 💾 Memory usage grows until the browser crashes
- 🎮 Frame rates drop unpredictably during gameplay
- 🔍 You can't diagnose the root cause without specialized tools
Browser GPU Profiler provides production-grade GPU monitoring directly in the browser:
- Real-time metrics - FPS, frame time, GPU utilization, memory usage
- Resource tracking - Monitor buffers and textures, detect leaks
- Shader profiling - Identify bottlenecks in your compute shaders
- Benchmark suite - Compare GPU capabilities across devices
- Export/Import - Share and analyze performance data
- Privacy-first - All data stays local, no external calls
Stop guessing. Start measuring. Ship better GPU-accelerated apps.
- Real-time GPU Monitoring - Track GPU utilization, memory usage, and performance metrics in real-time
- Memory Allocation Tracking - Monitor buffer and texture memory usage with detailed allocation history
- Shader Performance Profiling - Profile shader execution times and identify bottlenecks
- Comprehensive Benchmark Suite - Benchmark GPU compute, memory bandwidth, texture transfer, and more
- Cross-Device Comparison - Export and import benchmark results to compare across devices
- WebGPU-Native - Built specifically for WebGPU with modern APIs
- Privacy-First - All data stays local, nothing is sent to external servers
- TypeScript-First - Fully typed with comprehensive TypeScript support
- Zero Dependencies - Works completely standalone
npm install browser-gpu-profilerOr use with CDN:
<script type="module">
import { createGPUProfiler } from 'https://esm.sh/browser-gpu-profiler';
</script>Step 1: Install
npm install browser-gpu-profilerStep 2: Initialize & Start
import { createGPUProfiler } from 'browser-gpu-profiler';
// Create profiler instance
const profiler = createGPUProfiler({
enableMonitoring: true,
monitoringInterval: 1000, // Update every second
onMetricsUpdate: (metrics) => {
console.log('GPU Utilization:', metrics.utilization + '%');
console.log('FPS:', metrics.fps);
console.log('Memory Usage:', metrics.memoryUsed / 1024 / 1024 + ' MB');
},
});
// Initialize profiler
await profiler.initialize();
// Start profiling
profiler.start();Step 3: Get Results
// Run benchmarks
const results = await profiler.runBenchmarks();
console.log('Overall Score:', results.overallScore);
// Get performance statistics
const stats = profiler.getPerformanceStats();
console.log('Average FPS:', stats.avgFps);
console.log('95th Percentile Frame Time:', stats.frameTimePercentiles.p95, 'ms');
// Stop profiling when done
profiler.cleanup();That's it! You now have comprehensive GPU performance insights.
┌─────────────────────────────────────────────────────────────────┐
│ Your WebGPU Application │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Compute │ │ Graphics │ │ ML │ │
│ │ Shaders │ │ Rendering │ │ Inference │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Browser GPU Profiler │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Real-Time │ │ Resource │ │
│ │ Monitoring │ │ Tracking │ │
│ │ │ │ │ │
│ │ • FPS │ │ • Buffers │ │
│ │ • Frame Time │ │ • Textures │ │
│ │ • GPU Util │ │ • Memory Leaks │ │
│ │ • Memory Usage │ │ │ │
│ └──────────────────┘ └──────────────────┘ │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ │
│ │ Shader │ │ Benchmark │ │
│ │ Profiling │ │ Suite │ │
│ │ │ │ │ │
│ │ • Execution Time │ │ • Compute │ │
│ │ • Bottlenecks │ │ • Memory │ │
│ │ • Statistics │ │ • Texture │ │
│ │ │ │ • Comparison │ │
│ └──────────────────┘ └──────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ Actionable Insights │
│ │
│ • Optimize slow shaders │
│ • Fix memory leaks │
│ • Improve frame pacing │
│ • Compare hardware capabilities │
│ • Reduce power consumption │
└─────────────────────────────────────────────────────────────────┘
Browser GPU Profiler is a comprehensive GPU performance monitoring and analysis tool designed specifically for WebGPU applications. It provides real-time insights into GPU utilization, memory allocation, shader performance, and overall system capabilities.
Use Browser GPU Profiler when you need to:
- Optimize GPU Performance - Identify bottlenecks in your compute and graphics workloads
- Monitor Resource Usage - Track memory allocation and GPU utilization in real-time
- Compare Hardware - Benchmark GPU capabilities across different devices
- Profile Shaders - Analyze shader execution times and identify performance issues
- Debug Memory Issues - Track buffer and texture allocations with detailed history
- Validate WebGPU Support - Check device capabilities and feature support
Track GPU performance metrics as your application runs:
profiler.start();
// Metrics are collected automatically
profiler.pause(); // Pause collection
profiler.resume(); // Resume collection
profiler.stop(); // Stop collectionMonitor GPU memory allocation:
// Track buffer allocation
const buffer = device.createBuffer({ size: 1024, usage: GPUBufferUsage.STORAGE });
profiler.trackBuffer(buffer, 'my-buffer');
// Track texture allocation
const texture = device.createTexture({
size: [512, 512],
format: 'rgba8unorm',
usage: GPUTextureUsage.RENDER_ATTACHMENT,
});
profiler.trackTexture(texture, 'my-texture');
// Get memory metrics
const memoryMetrics = profiler.getMemoryMetrics();
console.log('Total Allocated:', memoryMetrics.totalAllocated / 1024 / 1024 + ' MB');Profile shader execution performance:
// Track shader execution
const startTime = performance.now();
// ... run shader ...
const executionTime = performance.now() - startTime;
profiler.trackShader('my-shader', 'main', executionTime * 1000); // Convert to microseconds
// Get shader metrics
const shaderMetrics = profiler.getShaderMetricsById('my-shader');
console.log('Average Execution Time:', shaderMetrics?.avgExecutionTime + ' μs');
console.log('Bottlenecks:', shaderMetrics?.bottlenecks);Run comprehensive GPU benchmarks:
// Run complete benchmark suite
const suite = await profiler.runBenchmarks();
console.log('Overall Score:', suite.overallScore);
suite.results.forEach(result => {
console.log(`${result.name}: ${result.score} ${result.unit}`);
});
// Run specific benchmark
const computeBenchmark = await profiler.runBenchmark('compute');
console.log('Compute Performance:', computeBenchmark.score, 'GFLOPS');Export and import benchmark results:
// Export results
const exported = profiler.exportToString();
// Import and compare
const importedData = profiler.import(exported);
const comparisons = profiler.compareWithImport(importedData);
comparisons.forEach(comp => {
console.log(`${comp.device}: ${comp.relativeScore}% of current device`);
});Problem: Your WebGPU game runs at 30 FPS but should be 60 FPS.
Solution:
const profiler = createGPUProfiler({
onMetricsUpdate: (metrics) => {
if (metrics.utilization > 90) {
console.log('GPU bottleneck - optimize shaders');
} else if (metrics.fps < 55) {
console.log('CPU bottleneck - reduce draw calls');
}
}
});
await profiler.initialize();
profiler.start();Problem: How does your app perform on different hardware?
Solution:
// Desktop
const desktop = await profiler.runBenchmarks();
fs.writeFileSync('desktop.json', profiler.exportToString());
// Laptop
const laptop = await profiler.runBenchmarks();
const comparison = profiler.compareWithImport(desktop);
console.log('Laptop is', comparison[0].relativeScore, '% of desktop');Problem: Memory usage grows until the browser crashes.
Solution:
profiler.start();
// Run your application...
await runAppForMinutes(30);
const history = profiler.getMemoryMetrics().history;
const trend = (history[history.length-1].totalAllocated / history[0].totalAllocated) - 1;
if (trend > 0.5) {
console.error('Memory leak detected! 50% increase in 30 minutes');
}Problem: Which shader is slowing down your ML model?
Solution:
for (const shader of ['data-prep', 'inference', 'post-process']) {
const start = performance.now();
await runShader(shader);
const duration = (performance.now() - start) * 1000; // μs
profiler.trackShader(shader, 'main', duration);
}
const metrics = profiler.getShaderMetrics();
metrics.forEach(m => {
console.log(`${m.shaderId}: ${m.avgExecutionTime}μs`);
console.log(`Bottlenecks:`, m.bottlenecks);
});Problem: Show live GPU stats to users (debug panel).
Solution:
const profiler = createGPUProfiler({
monitoringInterval: 500,
onMetricsUpdate: (metrics) => {
document.getElementById('fps').textContent = metrics.fps.toFixed(1);
document.getElementById('gpu').textContent = metrics.utilization + '%';
document.getElementById('memory').textContent =
(metrics.memoryUsed / 1024 / 1024).toFixed(1) + ' MB';
}
});Problem: Should you use GPU for your ML model?
Solution:
// Test CPU
const cpuStart = performance.now();
await runMLModelOnCPU();
const cpuTime = performance.now() - cpuStart;
// Test GPU
const gpuBenchmark = await profiler.runBenchmark('compute');
const speedup = cpuTime / gpuBenchmark.executionTime;
console.log(`GPU is ${speedup.toFixed(2)}x faster`);
if (speedup > 2) {
console.log('✅ Use GPU acceleration');
}Problem: Ensure performance before release.
Solution:
const profiler = createGPUProfiler();
await profiler.initialize();
profiler.start();
await simulateTypicalUserSession();
const stats = profiler.getPerformanceStats();
if (stats.avgFps < 30 || stats.frameTimePercentiles.p95 > 50) {
throw new Error('Performance targets not met!');
}Problem: Track memory allocations in real-time.
Solution:
profiler.trackBuffer(device.createBuffer({ size: 1024 * 1024 }), 'buffer-1mb');
profiler.trackTexture(device.createTexture({ size: [512, 512] }), 'texture-512px');
const memory = profiler.getMemoryMetrics();
console.log('Buffer Memory:', memory.bufferMemory / 1024 / 1024, 'MB');
console.log('Texture Memory:', memory.textureMemory / 1024 / 1024, 'MB');
console.log('Total:', memory.totalAllocated / 1024 / 1024, 'MB');Problem: Auto-adjust quality for different hardware.
Solution:
const benchmarks = await profiler.runBenchmarks();
let tier = 'low';
if (benchmarks.overallScore > 80) tier = 'ultra';
else if (benchmarks.overallScore > 60) tier = 'high';
else if (benchmarks.overallScore > 40) tier = 'medium';
applyQualitySettings(tier);
console.log(`Detected ${tier} tier hardware`);Problem: Compare against reference hardware.
Solution:
const current = await profiler.runBenchmarks();
const reference = profiler.import(fs.readFileSync('rtx-3080.json', 'utf-8'));
const comparison = profiler.compareWithImport(reference);
console.log('Your GPU vs RTX 3080:', comparison[0].relativeScore + '%');Explore our collection of real-world, production-ready examples:
- Game Performance Dashboard - Real-time FPS monitoring, GPU utilization graphs, and performance alerts for WebGPU games
- Shader Optimizer - Profile compute shaders, identify bottlenecks, and measure optimization improvements
- Cross-Device Benchmark - Run benchmarks, export results, compare performance across devices
- ML Model Performance - Compare GPU vs CPU performance for ML inference, make data-driven hardware decisions
- Real-Time Monitoring - Continuous monitoring with callbacks, threshold alerts, and production-ready patterns
Each example includes:
- ✅ Complete, runnable code
- ✅ Real-world use case description
- ✅ Production-ready implementation
- ✅ SEO-optimized comments
- ✅ Performance best practices
Main profiler class for GPU monitoring and benchmarking.
const profiler = new GPUProfiler(config?: GPUProfilerConfig);Config Options:
enableMonitoring?: boolean- Enable real-time monitoring (default:true)monitoringInterval?: number- Update interval in milliseconds (default:1000)enableMemoryTracking?: boolean- Enable memory tracking (default:true)enableShaderProfiling?: boolean- Enable shader profiling (default:true)maxHistorySize?: number- Maximum history size (default:1000)onMetricsUpdate?: (metrics: GPUMetrics) => void- Callback for metrics updatesonMemoryUpdate?: (memory: GPUMemoryMetrics) => void- Callback for memory updatesonShaderMetrics?: (shader: GPUShaderMetrics) => void- Callback for shader metrics
initialize(): Promise<void>- Initialize the profilerstart(): void- Start profilingstop(): void- Stop profilingpause(): void- Pause profilingresume(): void- Resume profilinggetDeviceInfo(): GPUDeviceInfo- Get GPU device informationgetCurrentMetrics(): GPUMetrics- Get current metricsgetMetricsHistory(): GPUMetrics[]- Get metrics historygetMemoryMetrics(): GPUMemoryMetrics- Get memory metricsgetShaderMetrics(): GPUShaderMetrics[]- Get all shader metricsgetShaderMetricsById(shaderId: string): GPUShaderMetrics | undefined- Get specific shader metricsgetPerformanceStats(): GPUPerformanceStats- Get performance statisticsrunBenchmarks(): Promise<GPUBenchmarkSuite>- Run complete benchmark suiterunBenchmark(type: GPUBenchmarkType): Promise<GPUBenchmarkResult>- Run specific benchmarktrackBuffer(buffer: GPUBuffer, label?: string): void- Track buffer allocationtrackTexture(texture: GPUTexture, label?: string): void- Track texture allocationtrackShader(shaderId: string, entryPoint: string, executionTime: number): void- Track shader executionclearMetrics(): void- Clear all metricsexport(): GPUProfilerExport- Export profiler dataimport(data: string): GPUProfilerImport- Import profiler datacleanup(): void- Clean up resources
createGPUProfiler(config?: GPUProfilerConfig): GPUProfiler- Create profiler instanceisWebGPUAvailable(): boolean- Check if WebGPU is availablegetGPUFeatures(): Promise<string[]>- Get supported GPU featuresgetGPULimits(): Promise<GPUSupportedLimits | null>- Get GPU limitsgetQuickDeviceInfo(): Promise<GPUDeviceInfo | null>- Get device info quickly
# Run tests
npm test
# Run tests with UI
npm run test:ui
# Run tests with coverage
npm run test:coverage# Install dependencies
npm install
# Build package
npm run build
# Run type checking
npm run type-check
# Run linting
npm run lint
# Format code
npm run formatBrowser GPU Profiler requires WebGPU support:
- ✅ Chrome 113+
- ✅ Edge 113+
- ✅ Firefox Nightly (with flags)
- ⏳ Safari (in development)
Check WebGPU availability:
import { isWebGPUAvailable } from 'browser-gpu-profiler';
if (!isWebGPUAvailable()) {
console.log('WebGPU is not supported in this browser');
}Contributions are welcome! Please read our contributing guidelines before submitting PRs.
MIT © SuperInstance
- Hardware Capability Profiler - Browser hardware profiling
- Privacy-First Analytics - Local analytics with insights
Built with ❤️ for the WebGPU community