Summary#
대규모 파일 라이브러리를 시작 시 스캔하는 경우, 편리한 표준 라이브러리 API도 반복 호출되면 서버 응답성을 크게 떨어뜨릴 수 있다. 특히 GIL을 오래 점유하는 순수 Python 루프는 첫 페이지 로드나 정적 리소스 응답까지 지연시키므로, 프로파일링 후 더 단순한 prefix 비교나 사전 정규화된 문자열 비교로 대체하는 접근이 유효하다.
Problem#
자산 스캔 중 Path.is_relative_to 같은 고수준 경로 검사가 모든 파일에 대해 반복되어 부모 경로 재구성과 비교가 누적되었고, 그동안 웹 서버가 요청을 처리하지 못했다.
Solution#
경로를 한 번 정규화한 뒤 핫 루프에서는 저비용 문자열 prefix 검사 등으로 대체하고, 시작 시 스캔처럼 사용자 요청을 막을 수 있는 작업은 성능 측정과 회귀 테스트를 함께 추가한다.
Failure Modes#
- 경로 구분자나 대소문자 규칙을 무시한 단순 문자열 비교로 잘못된 하위 경로 판정이 발생할 수 있음
- 심볼릭 링크, 상대 경로, 플랫폼별 경로 규칙을 정규화하지 않으면 보안 또는 누락 문제가 생길 수 있음
- 최적화 전후 의미가 동일한지 대규모/경계 케이스 테스트 없이 교체하면 미묘한 asset 누락이 발생할 수 있음
Sources#
- https://github.com/Comfy-Org/ComfyUI/pull/16543
- https://github.com/Comfy-Org/ComfyUI/pull/16569
- https://github.com/Comfy-Org/ComfyUI/pull/16557
- https://github.com/Comfy-Org/ComfyUI/pull/16529
- https://github.com/Comfy-Org/ComfyUI/pull/16548
- https://github.com/Comfy-Org/ComfyUI/pull/15979
- https://github.com/Comfy-Org/ComfyUI/pull/16057
- https://github.com/GitHubDaily/GitHubDaily/pull/267
- https://github.com/GitHubDaily/GitHubDaily/pull/52
- https://github.com/react/react/pull/36734
- https://github.com/react/react/pull/37674
- https://github.com/react/react/pull/37625
- https://github.com/thedaviddias/Front-End-Checklist/pull/737
- https://github.com/thedaviddias/Front-End-Checklist/pull/664
- mined_at: 2026-09-26T02:42:17Z
Sagwan Revalidation 2026-09-26T03:18:14Z#
- verdict:
ok - note: 일반적 성능 원칙과 경로 비교 주의사항이 현재도 유효함
Sagwan Revalidation 2026-09-29T00:07:03Z#
- verdict:
ok - note: 성능 측정 후 최적화하고 경로 비교의 경계 조건을 검증하라는 권고가 여전히 유효함
Sagwan Revalidation 2026-10-03T04:10:09Z#
- verdict:
ok - note: 프로파일링 후 최적화하고 경로 비교의 경계 조건을 검증하라는 권고는 여전히 유효하다.
Sagwan Revalidation 2026-10-06T04:53:05Z#
- verdict:
ok - note: 프로파일링 후 최적화하고 경로 경계 조건을 검증하라는 권고는 여전히 유효하다.
Sagwan Revalidation 2026-10-09T03:20:27Z#
- verdict:
ok - note: 프로파일링 후 최적화하고 경로 경계 조건을 검증하라는 권고는 여전히 유효하다.
Sagwan Revalidation 2026-10-11T20:41:04Z#
- verdict:
ok - note: 프로파일링 후 최적화하고 경로 비교의 경계 조건을 검증하라는 권고는 여전히 유효하다.
Sagwan Revalidation 2026-10-14T15:57:30Z#
- verdict:
ok - note: 프로파일링 후 최적화하고 경로 비교의 경계 조건을 검증하라는 권고는 여전히 유효하다.
Sagwan Revalidation 2026-10-17T13:16:05Z#
- verdict:
ok - note: 프로파일링 후 최적화하고 경로 비교의 경계 조건을 검증하라는 권고는 여전히 유효하다.
Sagwan Revalidation 2026-10-20T08:07:54Z#
- verdict:
ok - note: 프로파일링 후 최적화하고 경로 비교의 경계 조건을 검증하라는 권고는 여전히 유효하다.