Skip to content

refactor: 1차 대규모 View 리팩토링#309

Open
clxxrlove wants to merge 34 commits into
developfrom
refactor/#308/TWI-89
Open

refactor: 1차 대규모 View 리팩토링#309
clxxrlove wants to merge 34 commits into
developfrom
refactor/#308/TWI-89

Conversation

@clxxrlove
Copy link
Copy Markdown
Member

@clxxrlove clxxrlove commented May 18, 2026

🔗 관련 이슈

📙 작업 내역

  • 이전 PR (docs: AI 사용 구조 1차 개선 #306)으로 리베이스 후 작업했음
  • 주된 작업 요약은, 측정을 위한 환경 구성 (Example App 개선, UITest 환경 구성 등), 측정, 개선 후 재측정, 결과
  • (현재 Pass 3, 즉 3번째 작업) Pass 1과 Pass 2는 각각 측정 환경 구성 중 실패, 약한 타겟 설정으로 실패
  • (참고사항) 이후 Pass 4에서 추가 개선 예정 (SwiftUI Template 추가 검토, Image 관련 최적화 등),
    • 이번 브랜치에서 잡은 baseline 기준으로 추가 레포트 예정 (before vs Pass 4)
  • regression 여부 점검중, 이후 draft 해제 예정
  • 이하 AI 레포트, 자세한 사항은 docs/perf-infra/reports/2026-05-18-render-pass-3.md

Pass 3 정리 - UI Rendering 측정 및 최적화

한 줄 요약

Pass 3에서는 real-device xctrace 기반 UI Rendering 측정 체계를 구축하고, Home / GoalDetail / ProofPhoto / Stats 4개 feature의 주요 rendering scenario를 공식 baseline으로 수집했다.
최종 성과는 다음과 같다.

  • 공식 baseline 48 traces 수집
  • 최종 trace contamination 0 / 48 = 0%
  • GoalDetail idle TimelineView hotspot 3 / 3 reps에서 제거 = 100% 제거
  • HomeView parent read-set 17개 → 2개 = 88.2% 축소
  • ProofPhoto typing correctness 6 / 6 reps 검증 = 100%
  • Home card optimization 후보 6 / 6개 조사 후 skip/defer
  • 측정 근거 없는 speculative optimization 차단

1. 핵심 성과 숫자

구분 수치 해석
공식 baseline trace 48개 8 scenarios × 2 templates × 3 reps
최종 baseline contamination 0 / 48 = 0% 공식 trace set 기준 오염 없음
측정 대상 feature 4개 Home, GoalDetail, ProofPhoto, Stats
측정 시나리오 8개 각 feature별 2개
사용한 Instruments template 2개 Time Profiler + Animation Hitches
재수집 성공률 3 / 3 = 100% 오염/실패 trace는 모두 폐기 후 재수집
GoalDetail idle hotspot 제거 3 / 3 = 100% TP 3개 rep에서 TimelineView frame 제거
HomeView parent read-set 축소 17 → 2 = 88.2% 감소 구조적 SwiftUI observation 개선
ProofPhoto typing 검증 6 / 6 = 100% comment-text.abcde marker 도달
Commit 6 후보 필터링 6 / 6 = 100% skip/defer 측정 근거 없는 위험 리팩터링 방지
공식 개선 commit 유지 2개 Commit 3 structural keep, Commit 7 measurable keep
speculative commit 차단 3개 Commit 4 / 5 / 6 skip 또는 hold

2. 가장 강하게 말할 수 있는 성과

2.1 GoalDetail idle TimelineView hotspot 100% 제거

Before에서는 GoalDetail initial render에서 TimelineView<>.UpdateFilter.updateValue()가 top user-code frame으로 반복 등장했다.
Commit 7 이후에는 해당 frame이 Time Profiler 3개 rep에서 모두 사라졌다.

Metric Before After 개선
TimelineView hotspot 출현 3 / 3 TP reps 0 / 3 TP reps 100% 제거
frame cost 9–12ms top-10에서 사라짐 관측 hotspot 제거
활성 reaction 시나리오 회귀 없음 없음 0 regression
정리 문장:

GoalDetail idle 상태에서 불필요하게 유지되던 60Hz TimelineView user-code hotspot을 3/3 trace에서 제거했다. 전체 wall-time 대형 개선은 아니지만, Pass 2/3에서 반복 관측된 idle CPU hotspot을 100% 제거한 targeted improvement다.


2.2 HomeView parent read-set 88.2% 축소

Commit 3은 직접적인 rendering wall-time 개선은 noise 범위 안이었지만, SwiftUI observation 구조 개선은 명확하다.

항목 Before After 감소율
Parent HomeView가 직접 읽는 주요 store field 17개 2개 88.2% 감소
정리 문장:

HomeView parent body의 직접 state read-set을 17개에서 2개로 줄여 88.2% 축소했다. 측정상 wall-time 개선은 noise floor 안이라 성능 개선 evidence로는 주장하지 않지만, SwiftUI observation invalidation scope를 구조적으로 좁힌 cleanup으로 유지한다.
주의:

  • 렌더링 시간 88% 개선 아님
  • 정확한 표현은 HomeView parent read-set 88.2% 축소

2.3 공식 baseline 48 / 48 clean traces 확보

측정 자동화/신뢰도 구축 성과로 가장 강하게 말할 수 있는 부분이다.

항목 수치
공식 trace 수 48
최종 contamination 0
공식 clean rate 100%
재수집으로 제거한 문제 trace 3
최종 잔류 오염 0
정리 문장:

SpringBoard activation, BannerNotification, xctrace attach failure, keyboard marker failure 등 contamination 기준을 적용해 문제 trace를 모두 폐기했고, 최종 공식 baseline은 48/48 clean trace로 확정했다.


2.4 ProofPhoto typing correctness 100% 검증

ProofPhoto comment typing은 marker를 추가해 실제 입력 성공 여부를 검증했다.

항목 수치
comment typing official reps 6
comment-text.abcde marker 도달 6
입력 검증 성공률 100%
정리 문장:

실기기 키보드/IME 상태에 따라 typeText가 silent pass할 수 있는 문제를 marker로 차단했고, ProofPhoto comment typing 시나리오에서 6/6 rep 모두 실제 store.commentText == "abcde" 도달을 검증했다.


2.5 Home card optimization 후보 6 / 6개 skip/defer

Commit 6은 무작정 구현하지 않고, GoalCardView / HomeGoalItem 계열이 실제 병목인지 조사했다.

후보 판단
GoalCardView EquatableView skip
HomeGoalItem.goal 제거 skip
closure 캡처 축소 skip
shape / placeholder 캐싱 skip
URL(string:) 캐싱 skip
KFImage 튜닝 Phase 2 defer
총 후보 skip/defer
---: ---:
6 6 = 100%
정리 문장:

Home card rendering 후보 6개를 조사했고, 공식 trace에서 GoalCardView/HomeGoalItem hotspot이 발견되지 않아 6/6 후보를 skip/defer했다. 측정 근거 없는 EquatableView 적용으로 stale UI risk를 만드는 것을 차단했다.


3. 최종 성과 표

성과 카테고리 숫자 공격적인 표현
측정 커버리지 4 features / 8 scenarios / 48 traces 앱 주요 VoC UI rendering path 전수 측정
trace 품질 48 / 48 clean 공식 baseline contamination 0%
hotspot 제거 3 / 3 TP reps GoalDetail idle TimelineView hotspot 100% 제거
구조 개선 17 → 2 reads HomeView parent read-set 88.2% 축소
오염 trace 처리 3 / 3 재수집 문제 trace 100% 격리/재수집
입력 검증 6 / 6 marker pass ProofPhoto comment typing silent-pass 방지
저효율 후보 차단 6 / 6 skip/defer 근거 없는 카드 리팩터링 100% 차단
speculative commits 차단 3개 hold/skip Commit 4 / 5 / 6 불필요한 attribution 악화 방지

4. 성과 요약

Pass 3 성과:

  • 공식 UI Rendering baseline 48 traces 수집, 최종 contamination 0%
  • GoalDetail idle TimelineView hotspot 100% 제거: 3/3 TP reps에서 top user-code frame 소멸
  • HomeView parent read-set 88.2% 축소: 17 reads → 2 reads
  • ProofPhoto typing correctness 100% 검증: 6/6 reps에서 comment-text.abcde marker 도달
  • 오염/실패 trace 3건 100% 격리 후 재수집
  • Home card optimization 후보 6/6개 조사 후 skip/defer: 측정 근거 없는 stale-UI-risk 최적화 차단

5. 최종 결론

이번 Pass의 가장 강한 정량 성과는 다음 3개다.

  1. GoalDetail idle TimelineView hotspot 100% 제거
  2. official baseline 48 / 48 clean trace 확보
  3. HomeView parent read-set 88.2% 축소

최종 표현:

이번 Pass는 대형 wall-time 개선보다는, real-device Instruments 기반 측정 체계 확립과 targeted hotspot 제거에 성공한 작업이다. 최종적으로 48개 clean baseline trace를 확보했고, GoalDetail idle TimelineView hotspot을 3/3 trace에서 제거했으며, HomeView read-set을 88.2% 축소했다. 반대로 측정 근거가 없는 Home card / GoalCardView 최적화 후보는 구현하지 않고 skip하여, 성능 개선 attribution과 UI 안정성을 보존했다.

clxxrlove added 30 commits May 16, 2026 11:35
@linear
Copy link
Copy Markdown

linear Bot commented May 18, 2026

TWI-89

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Review Change Stack

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f49b4f06-51bb-499b-94d9-54ef81cf61c4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Shared PerfTestingSupport 모듈 추가와 Tuist 설정 확장, 각 Feature 예제/UITest 계측 및 시드 도입, GoalDetail/Home/ProofPhoto/Stats 코드·뷰 업데이트, twix-gate 확장, 수집/스모크 스크립트, 아키텍처·레퍼런스 문서와 스킬 스펙 정비가 포함됩니다.

Changes

Perf 인프라·예제 계측·문서/스킬·게이트 통합 업데이트

Layer / File(s) Summary
프로젝트 전반 반영(모듈/코드/UITest/스크립트/문서/스킬)
Projects/Shared/PerfTestingSupport/*, Projects/Feature/*, Tuist/*, .pi/extensions/twix-gate.ts, Scripts/*, docs/*, .pi/skills/*, .claude/skills/*, .codex/skills/*, AGENTS.md, Claude.md, .gitignore, Prompt.md, Rules.md
Shared PerfTestingSupport 추가, Feature 예제/UITest 계측·시드 도입과 일부 뷰/내비 리팩터, twix-gate 정책 추가, 수집/스모크 스크립트, 문서와 스킬 스펙 정리 및 .gitignore 갱신까지 일괄 반영.

Sequence Diagram(s)

sequenceDiagram
  participant Dev
  participant Repo
  participant UITests
  participant Device
  participant xctrace
  Dev->>Repo: tuist generate / build (Profile)
  UITests->>Device: launchForPerf(-UITEST, seed, scenario)
  Device-->>UITests: feature.<slug>.ready
  UITests->>xctrace: record attach (Time Profiler/Hitches)
  xctrace-->>Dev: trace bundles
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Suggested labels

🔨 refactor

Suggested reviewers

  • jihun32
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/#308/TWI-89

@clxxrlove
Copy link
Copy Markdown
Member Author

@coderabbitai summary

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

✅ Actions performed

Summary regeneration triggered.

@clxxrlove clxxrlove marked this pull request as draft May 18, 2026 14:46
@clxxrlove clxxrlove marked this pull request as ready for review May 19, 2026 09:35
@github-actions github-actions Bot added D-2 and removed D-3 labels May 19, 2026
@github-actions github-actions Bot added D-1 and removed D-2 labels May 20, 2026
Copy link
Copy Markdown
Contributor

@jihun32 jihun32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전 pr에서 말한 Mocking용 Testing 모듈이 없어서 여기저기 mocking용 client 구현된 거 같아서 Testing 모듈로 분리하면서 같이 리팩토링할게~~
코멘트 몇개 확인 ㄱㄱ
고생해써~

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아직 뒷커밋들 안봐서 판단하긴 애매한데 SharedPerfTestingSupport 내부 파일 계속 쓰는거면 public한 것들에 문서화 주석 누락 됐던데 한글로 달아주라

/// some buttons on iOS 26.2 simulator. **The harness must NOT be mixed
/// into authoritative rendering scenarios** — rendering scenarios launch
/// via `-UITEST_RENDERING_SCENARIO` which keeps this harness disabled.
private struct HomePerfActionHarness: View {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 있는 이유가 뭐지?
기존 View에서 UITest 했을 때 나온 성능 이슈를 개선하려고 테스트 해보기 위해 있는건가

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다음 PR에서 작업 됐을 거 같긴한데 안돼있다면 내부 View struct로 나눈 것들 파일로 분리하자

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants