Skip to content

perf: release 빌드에 LTO + codegen-units=1 + strip 활성화#818

Closed
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/enable-lto-release
Closed

perf: release 빌드에 LTO + codegen-units=1 + strip 활성화#818
oksure wants to merge 2 commits into
edwardkim:develfrom
oksure:contrib/enable-lto-release

Conversation

@oksure

@oksure oksure commented May 11, 2026

Copy link
Copy Markdown
Contributor

요약

[profile.release]에 LTO(Fat), codegen-units=1, strip 옵션을 추가하여 릴리즈 바이너리 크기를 줄이고 런타임 성능을 개선합니다.

변경 사항

  • lto = true — Fat LTO로 크로스 크레이트 인라이닝 최적화
  • codegen-units = 1 — 단일 코드젠 유닛으로 전역 최적화 극대화
  • strip = true — 심볼 테이블 제거로 바이너리 크기 축소

벤치마크 (Linux x86_64, Rust 1.87)

설정 바이너리 크기 클린 빌드 시간
기존 Release ~10MB ~58s
LTO + CU1 + strip 7.8MB ~2m 42s

개발 빌드(cargo build)에는 영향 없음 — release 프로파일에만 적용됩니다.

Closes #790

감사합니다.

Reduces release binary size (~23% reduction) and improves runtime
performance through more aggressive compiler optimizations.

Only affects release profile — development builds remain fast.

Closes edwardkim#790
Copilot AI review requested due to automatic review settings May 11, 2026 06:10

Copilot AI left a comment

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.

Pull request overview

This PR updates the Rust build configuration to optimize release artifacts by enabling more aggressive compiler/linker optimizations and stripping.

Changes:

  • Enable Fat LTO for cross-crate optimization in release builds.
  • Force codegen-units = 1 to maximize global optimization opportunities.
  • Enable strip in release builds to reduce final artifact size.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Cargo.toml Outdated
[profile.release]
lto = true
codegen-units = 1
strip = true
Copilot 리뷰 반영: strip=true는 심볼까지 제거하여 panic backtrace가
무용해짐. strip="debuginfo"로 변경하여 DWARF만 제거하고 심볼은 보존.
@oksure

oksure commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

Copilot 리뷰 반영 (cdde2bd):

  • strip = truestrip = "debuginfo"로 변경. 심볼 테이블을 보존하여 panic backtrace 가독성을 유지하면서 DWARF 디버그 정보만 제거합니다.

edwardkim added a commit that referenced this pull request May 11, 2026
…p 활성화

@oksure — Issue #790 (외부 제안): Cargo.toml [profile.release] 영역 LTO + codegen-units=1
+ strip 활성화 영역 바이너리 크기 축소 + 런타임 성능 개선.

본질 (2 commits, Cargo.toml +5/-0):
- lto = true (Fat LTO, 크로스 크레이트 인라이닝 최적화)
- codegen-units = 1 (단일 코드젠 유닛, 전역 최적화 극대화)
- strip = "debuginfo" (디버그 정보 제거, panic backtrace symbol table 보존)
  - 리뷰 반영 commit (9ccb0c3): strip = true → strip = "debuginfo" 정정

본 환경 충돌 수동 해결 (Cargo.toml):
- devel 측 — PR #599 example pr599_png_gateway (native-skia required)
- PR 측 — [profile.release] 영역 5 라인 추가
- 양측 모두 보존 (PR #599 example + [profile.release] 정합)

본 환경 정량 측정:
| 항목 | before | after | 차이 |
|------|--------|-------|------|
| rhwp CLI 크기 | 14 MB | 10 MB | -4 MB (-28%) |
| WASM 크기 | 4.6 MB | 4.3 MB | -0.3 MB (-6.5%) |
| cargo build --release (clean) | ~58s | 2m 53s | +1m 55s (~3배) |
| WASM 빌드 (Docker) | ~1m 30s | 2m 23s | +53s (+59%) |
| cargo test | ALL GREEN | ALL GREEN | 회귀 0 |
| cargo clippy -D warnings | 통과 | 통과 | 회귀 0 |
| sweep 7 fixture / 170 페이지 | baseline | 170 same / 0 diff | byte-identical |

→ 빌드 시간 ~3배 증가 영역 release 빌드 한정 (개발 빌드 영향 부재).
sweep byte-identical 영역 SVG 출력 무영향 입증.
@edwardkim

Copy link
Copy Markdown
Owner

@oksure 머지 완료 (commit f5abcf8d).

본 환경 정량 측정 결과 — 매우 좋은 이득:

  • rhwp CLI: 14 MB → 10 MB (-28%)
  • WASM: 4.6 MB → 4.3 MB (-6.5%)
  • cargo build --release (clean): ~58s → 2m 53s
  • WASM 빌드 (Docker): ~1m 30s → 2m 23s

자기 검증 — cargo test ALL GREEN + cargo clippy -D warnings 통과 + 광범위 sweep 7 fixture / 170 페이지 / 회귀 0 (byte-identical) 입증. 빌드 시간 증가 영역 release 빌드 한정 영역 개발 빌드 영향 부재.

strip = "debuginfo" 리뷰 반영 영역 panic backtrace symbol table 보존 정합.

본 환경 충돌 수동 해결 (Cargo.toml): devel 측 PR #599 example pr599_png_gateway + PR 측 [profile.release] 양측 보존.

수고하셨습니다.

@edwardkim edwardkim closed this May 11, 2026
edwardkim added a commit that referenced this pull request May 11, 2026
- mydocs/pr/archives/pr_818_review.md (LTO + CU1 + strip 분석)
- mydocs/pr/archives/pr_818_report.md (옵션 A 처리 결과 + 정량 측정)
- mydocs/orders/20260512.md PR #818 행 추가

본 환경 정량 측정:
- rhwp CLI: 14 MB → 10 MB (-28%)
- WASM: 4.6 MB → 4.3 MB (-6.5%)
- cargo build --release: ~58s → 2m 53s (~3배)
- WASM 빌드 (Docker): ~1m 30s → 2m 23s (+59%)
- sweep 7 fixture / 170 페이지 / byte-identical 입증
- cargo test/clippy ALL GREEN
edwardkim added a commit that referenced this pull request May 17, 2026
버전 0.7.11 → 0.7.12 (Cargo.toml + rhwp-vscode/npm-editor/rhwp-studio package.json)
CHANGELOG 갱신 (CHANGELOG.md / CHANGELOG_EN.md / rhwp-vscode/CHANGELOG.md)
WASM 재빌드 산출물 동기화 (rhwp-studio/public/rhwp.js)

@jangster77 7-PR 시리즈 (#956~#968) + Issue #952 5-결함 완결 + WMF #966 + HWP3 #968 + LTO #818

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@edwardkim edwardkim mentioned this pull request May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants