Skip to content

미주 많은 문서 로딩 지연: 미주 단 측정 재생마다 수식 재계산 #8204

Open

Description

@planet6897

증상

미주가 많은 시험지 문서를 여는 데 수 초가 걸린다. 미주가 없는 문서는 같은 크기여도 빠르다.

문서 rhwp info (release, devel 9418ed0c7) WASM(Node) 문서 열기
samples/3-11월_실전_통합_2022.hwp 6.87초 10.4초
samples/3-09월_교육_통합_2022.hwp 8.63초 14.5초
samples/3-10월_교육_통합_2022.hwp 8.40초 —

#8191 이전 커밋에서도 시간은 같았다(그 PR 의 회귀가 아니다).

원인 (callgrind, 3-11월 info 1회)

  • 미주 fit 판정은 measure_endnote_column_with_items(src/renderer/typeset/notes/endnotes/measure.rs)와 simulate_endnote_column_extent 에서 실제 배치 경로(LayoutEngine::build_single_column)로 단 전체를 재생한다(sim==render 계약, 미주(endnote) 높이 모델 SSOT 리팩터 — typeset 누적과 layout 렌더 높이 단일화 #1363 v3 A3).
  • 재생마다 같은 수식을 처음부터 다시 계산한다. equation::flow_metrics_hwp 가 58만 5천 회 호출돼 전체 명령어의 71.7% 를 차지했고, paint 조각(토큰화→파싱→레이아웃→SVG 문자열) 생성도 큰 비중이었다.
  • 같은 상태에서 같은 후보·예산으로 같은 단 측정을 반복하는 경우도 많았다.

기대

출력(쪽 구성·SVG)을 바꾸지 않고, 측정과 실제 배치가 같은 결과를 소비한다는 계약을 유지한 채 반복 계산을 없앤다.

범위

  • 수식 흐름 프레임·paint 조각을 수식 값으로 키를 잡아 재사용
  • 같은 조판 상태 세대 안에서 같은 미주 단 측정 질의 재사용
  • 비범위: build_single_column 의 증분(중간 상태 저장·재개) 측정 — 위 두 가지 뒤 남는 비용은 처음의 약 1/10 이며 위험이 커서 별도로 다룬다.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions