skills/performance_profiling/SKILL.md
--- name: performance_profiling router_kit: FullStackKit description: CPU/Memory profiling, bottleneck analizi, benchmark teknikleri ve performans optimizasyonu rehberi. metadata: skillport: category: optimization tags: [big data, cleaning, csv, data analysis, data engineering, data science, database, etl pipelines, export, import, json, machine learning basics, migration, nosql, numpy, pandas, performance profiling, python data stack, query optimization, reporting, schema design, sql,
npx skillsauth add vuralserhat86/antigravity-agentic-skills skills/performance_profilingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CPU, Memory profiling ve bottleneck analizi rehberi.
// Console timing
console.time('operation');
// ... code
console.timeEnd('operation');
// Performance API
const start = performance.now();
// ... code
const end = performance.now();
console.log(`Execution time: ${end - start}ms`);
# CPU profiling
node --prof app.js
node --prof-process isolate-*.log > profile.txt
# Clinic.js (kapsamlı)
npx clinic doctor -- node app.js
npx clinic flame -- node app.js
npx clinic bubbleprof -- node app.js
const v8Profiler = require('v8-profiler-next');
v8Profiler.startProfiling('CPU');
// ... code
const profile = v8Profiler.stopProfiling('CPU');
profile.export((error, result) => {
fs.writeFileSync('profile.cpuprofile', result);
profile.delete();
});
import { Profiler } from 'react';
function onRenderCallback(
id, phase, actualDuration, baseDuration, startTime, commitTime
) {
console.log({ id, phase, actualDuration, baseDuration });
}
<Profiler id="MyComponent" onRender={onRenderCallback}>
<MyComponent />
</Profiler>
// wdyr.js
import React from 'react';
import whyDidYouRender from '@welldone-software/why-did-you-render';
whyDidYouRender(React, {
trackAllPureComponents: true,
});
// useMemo - hesaplama cache
const expensiveValue = useMemo(() => computeExpensive(a, b), [a, b]);
// useCallback - fonksiyon referans
const handleClick = useCallback(() => doSomething(id), [id]);
// React.memo - component memoization
const MemoizedComponent = React.memo(MyComponent);
| Kaynak | Örnek | Çözüm |
|--------|-------|-------|
| Event listeners | addEventListener | removeEventListener cleanup |
| Timers | setInterval | clearInterval cleanup |
| Closures | Büyük objeler referans | Weak references |
| DOM references | Detached DOM | Null atama |
| Global variables | window.data = large | Scope sınırlama |
1. Memory tab → Heap snapshot
2. Perform actions
3. Take another snapshot
4. Compare snapshots (Comparison view)
5. Filter by "Detached" for DOM leaks
# Memory usage monitoring
node --expose-gc app.js
# heapdump
npm install heapdump
const heapdump = require('heapdump');
heapdump.writeSnapshot('./heap-' + Date.now() + '.heapsnapshot');
// Benchmark.js
const Benchmark = require('benchmark');
const suite = new Benchmark.Suite;
suite
.add('Method A', () => methodA())
.add('Method B', () => methodB())
.on('cycle', (event) => console.log(String(event.target)))
.on('complete', function() {
console.log('Fastest: ' + this.filter('fastest').map('name'));
})
.run({ async: true });
# autocannon (Node.js)
npx autocannon -c 100 -d 30 http://localhost:3000
# wrk
wrk -t12 -c400 -d30s http://localhost:3000
# ab (Apache Bench)
ab -n 10000 -c 100 http://localhost:3000/
npx lhci autorun --collect.url=http://localhost:3000
-- Slow query log
ALTER SYSTEM SET log_min_duration_statement = 1000; -- 1s
-- EXPLAIN ANALYZE
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT * FROM users WHERE email = '[email protected]';
-- pg_stat_statements
SELECT query, calls, mean_time, total_time
FROM pg_stat_statements
ORDER BY total_time DESC
LIMIT 10;
// Profiling enable
db.setProfilingLevel(1, { slowms: 100 });
// Query profiler
db.system.profile.find().sort({ ts: -1 }).limit(10);
// Explain
db.users.find({ email: "[email protected]" }).explain("executionStats");
- [ ] Bundle size analizi (webpack-bundle-analyzer)
- [ ] Core Web Vitals (LCP, FID, CLS)
- [ ] Network waterfall analizi
- [ ] Memory leak kontrolü
- [ ] Database query optimization
- [ ] Caching stratejisi (Redis, CDN)
- [ ] Code splitting / Lazy loading
Performance Profiling v1.1 - Enhanced
Kaynak: Chrome DevTools Performance Features & Node.js Diagnostics
Node --prof veya py-spy, Frontend için Chrome DevTools.| Aşama | Doğrulama | |-------|-----------| | 1 | Profiling yaparken Debug mod (logging) kapalı mı? | | 2 | Anonim fonksiyonlar yerine isimlendirilmiş fonksiyonlar kullanılıyor mu? (Stack trace okunabilirliği için). | | 3 | "Idle" zamanı ile "System" zamanı ayrıştırıldı mı? |
tools
Production-tested setup for Zustand state management in React. Includes patterns for persistence, devtools, and TypeScript patterns. Prevents hydration mismatches and render loops.
development
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas
development
--- name: websocket_engineer router_kit: FullStackKit description: WebSocket specialist for real-time communication systems. Invoke for Socket.IO, WebSocket servers, bidirectional messaging, presence systems. Keywords: WebSocket, Socket.IO, real-time, pub/sub, Redis. triggers: - WebSocket - Socket.IO - real-time communication - bidirectional messaging - pub/sub - server push - live updates - chat systems - presence tracking role: specialist scope: implementation output-format:
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.