Files
2nd/10_Wiki/Topic_Programming/DevOps_and_Security/Analyze runtime performance.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

4.6 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-analyze-runtime-performance Analyze runtime performance 10_Wiki/Topics verified self
Performance Analysis
Profiling
Runtime Profiling
none A 0.9 applied
profiling
performance
devtools
2026-05-10 applied
language framework
JavaScript/Python Chrome DevTools/perf/py-spy

Analyze runtime performance

매 한 줄

"매 측정 없이 최적화 없다.". Runtime performance 분석은 sampling profiler + tracing + flame graph + RAIL/Web Vitals metrics 의 stack 으로 매 hot path 와 long task 를 식별. 2026 stack: Chrome Performance panel (Insights AI), perf+FlameGraph, py-spy, eBPF/bpftrace, Datadog APM.

매 핵심

매 Profiler Type

  • Sampling: 매 N ms 마다 stack 캡처 — 매 low overhead, statistical (perf, py-spy, async-profiler).
  • Instrumentation: 매 fn enter/exit 기록 — 매 accurate, high overhead.
  • Tracing: 매 event timeline (Chrome trace, perfetto).
  • Hardware counters: PMU — IPC, cache miss, branch miss.

매 RAIL Model (web)

  • Response: < 100ms input → feedback.
  • Animation: < 16ms / frame (60fps).
  • Idle: 50ms work blocks max.
  • Load: < 5s on 4G.

매 Core Web Vitals 2026

  • LCP (Largest Contentful Paint) < 2.5s.
  • INP (Interaction to Next Paint) < 200ms — 매 FID 대체 (2024+).
  • CLS (Cumulative Layout Shift) < 0.1.

매 응용

  1. Web app TTI/INP 개선.
  2. Backend p99 latency 추적.
  3. Game/XR frame budget.
  4. ML inference latency.
  5. CI pipeline 시간 단축.

💻 패턴

Chrome Performance panel + AI insights

// 매 manual marker — show up in Performance timeline
performance.mark('ai-search:start');
const r = await search(q);
performance.mark('ai-search:end');
performance.measure('ai-search', 'ai-search:start', 'ai-search:end');
// 매 record trace in DevTools → AI Insights highlights bottleneck (2025+)

User Timing API + reporter

const obs = new PerformanceObserver(list => {
  list.getEntries().forEach(e => analytics('perf', { name: e.name, dur: e.duration }));
});
obs.observe({ entryTypes: ['measure', 'navigation', 'resource', 'longtask'] });

py-spy live flame graph

# 매 attach to running PID, no code change
py-spy record -o flame.svg --pid 12345 --duration 30
# 매 live top-like
py-spy top --pid 12345

Linux perf flame graph

sudo perf record -F 99 -g -p $PID -- sleep 30
sudo perf script | \
  ./stackcollapse-perf.pl | ./flamegraph.pl > flame.svg

Web Vitals INP measurement

import { onINP, onLCP, onCLS } from 'web-vitals';
onINP(m => beacon('inp', m.value, m.id));
onLCP(m => beacon('lcp', m.value, m.id));
onCLS(m => beacon('cls', m.value, m.id));

Node --prof + --prof-process

node --prof server.js
# 매 after run
node --prof-process isolate-*.log > profile.txt

eBPF (bpftrace) syscall latency

sudo bpftrace -e '
  tracepoint:syscalls:sys_enter_read { @s[tid] = nsecs; }
  tracepoint:syscalls:sys_exit_read /@s[tid]/ {
    @us = hist((nsecs - @s[tid]) / 1000);
    delete(@s[tid]);
  }'

매 결정 기준

상황 Tool
Web (Chromium) DevTools Performance + Web Vitals
Node.js clinic.js / 0x / --prof
Python py-spy / scalene / cProfile
JVM async-profiler / JFR
Go pprof
Linux native perf + FlameGraph / eBPF
Production APM Datadog / NewRelic / OTel

기본값: 매 sampling profiler 우선, instrumentation 은 spot-check.

🔗 Graph

🤖 LLM 활용

언제: flame graph 해석, perf insight 요약, regression hypothesis. 언제 X: 매 nanosecond-level profiling — specialized tool 만이 정확.

안티패턴

  • Production 에 instrumenting profiler: 매 overhead 폭발.
  • Single-run 결론: 매 statistical noise — multi-run 필요.
  • Average only: 매 p50 보다 p99 가 user 체감.
  • Profile dev build: 매 prod build 와 다름 — release/optimized 측정.

🧪 검증 / 중복

  • Verified: web.dev Performance docs; Brendan Gregg "Systems Performance"; Chrome DevTools docs.
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — RAIL/INP + multi-language profilers