nuke-optimize
하는 일
이 스킬은 Nuke 라이브러리를 쓰는 앱에서 이미지 로딩이 느리거나 메모리를 많이 쓰는 원인을 찾습니다. 더 부드러운 이미지 화면을 원하는 iPhone과 Mac 개발자를 위한 것입니다.
사용하는 경우
- ✓앱의 이미지가 느리게 로드되거나 캐시가 자꾸 빗나갈 때.
- ✓사진이 많은 화면에서 스크롤이 끊길 때.
- ✓이미지 때문에 앱의 메모리 사용량이 계속 늘 때.
스킬 링크
https://github.com/kean/Nuke/blob/main/skills/nuke-optimize/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 사진 목록이 스크롤할 때 끊기고 메모리를 너무 많이 씁니다. 이유를 찾아서 Nuke 설정을 고쳐 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 Nuke의 진단 로그를 켜고, 이미지 작업마다 한 줄씩 나오는 로그를 읽어 시간이 어디에 쓰이는지 확인합니다. 그리고 한 번에 한 가지만 바꾸고 다시 측정합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Optimizing Nuke
Nuke's defaults come from benchmarks, so the gains are almost always in how the app asks for images, and rarely in its configuration. A 12 MP photo decoded for a 120-point cell costs 46 MB, and no setting makes up for that.
Measure first, change one thing, and measure again. Each change here has a cost, and some make things worse when the cause is something else. If you can't run the app, say that what you changed comes from reading the code, and that it's unmeasured. For the API in general, see llms-full.txt at the root of the package.
Measure
Launch with NUKE_DIAGNOSTICS_LOG=1, in the scheme or like this, and read one line per task:
SIMCTL_CHILD_NUKE_DIAGNOSTICS_LOG=1 xcrun simctl launch booted <bundle-id>
xcrun simctl spawn booted log stream --predicate 'subsystem == "com.github.kean.Nuke.ImagePipeline"'
ImageTask #1 · success · 78.5 ms · from network · https://example.com/a.png · 1200×800 · png · 3.7 MB in memory · 70 KB
Go through the slow screen twice: once on a fresh install, and again after relaunching.
| In the log | It means | Go to |
|---|---|---|
from network after a relaunch |
The disk cache missed | Cache keys, Disk cache |
from httpCache, and tens of ms |
URLCache asked the server whether the image changed |
Disk cache |
MB in memory over width × height × 4 of the cell, in pixels |
The image is bigger than what's displayed | Decode less |
The same URL twice, with no coalesced |
Two requests that differ, so nothing is shared | Cache keys, Prefetching |
| More lines than cells on screen, on open | Everything loads at once | Load only what's on screen |
A long list of cancelled |
Normal while scrolling fast: the cells cancel the loads they scrolled past | Nothing |
For where the time of a slow task went:
let pipeline = ImagePipeline { $0.isDiagnosticsEnabled = true }
let task = pipeline.imageTask(with: url)
_ = try await task.image
print(task.metrics!.formatted([.header, .breakdown]))
time: network 93.6 ms (66%) · process 42.5 ms (30%) · cache 0.5 ms · decode 0.3 ms · queue 0.1 ms · other 3.8 ms (3%)
| Largest share | Cause |
|---|---|
network |
The file is too big, it wasn't cached, or the app opened a new connection |
process, decode, decompress |
The image is bigger than it needs to be |
queue |
The task waited for a slot. Prefetching, or too many images at once |
isDiagnosticsEnabled costs a few microseconds a task, and it sends signposts, so the same stages show up in Instruments under os_signpost. For a task that hangs, po ImagePipeline.shared.diagnostics in the debugger prints the queues and the memory cache.
Read the code
# More than one pipeline, or one created in a view
grep -rnE 'ImagePipeline(\(| \{)' --include='*.swift' .
# Every image load: does each one know the size it's displayed at?
grep -rnE 'LazyImage\(|ImageLoader\.load|FetchImage\(|\.image\(for:|imageTask\(with:' --include='*.swift' .
# Disk I/O that blocks the caller, which is a problem on the main thread
grep -rnE 'cachedData\(|cachedImage\(|containsCachedImage|containsData\(|storeCachedImage' --include='*.swift' .
# Prefetchers, and whether they build the same request as the views
grep -rn 'ImagePrefetcher' --include='*.swift' .
# Defaults someone changed: find out why before you keep or remove them
grep -rnE 'isTaskCoalescingEnabled|isDecompressionEnabled|skipDecompression|isProgressiveDecodingEnabled|isResumableDataEnabled|TaskQueue\(|maxConcurrentTaskCount|costLimit|sizeLimit' --include='*.swift' .
# Processors of your own: is the identifier stable?
grep -rnE ': ImageProcessing\b' --include='*.swift' .
What to fix, in the order it pays
Download less
The cheapest image is the one the server resizes. If the CDN takes a size, as in ?w=360, ask for the size you display. That saves the data, the decode, and the memory, and nothing below does all three.
A decoded image has a scale of 1, so a 360-pixel file is 360 points wide. If the view shows it at its natural size, or a processor of yours draws in points, set request.scale to the scale of the screen.
Decode less
Tell the pipeline the size you display at, in the request or with .processors. A SwiftUI .frame doesn't: it scales a full-size bitmap on every draw.
LazyImage(url: url) { state in
자주 묻는 질문
속도는 어떻게 측정하나요?
Nuke의 진단 로그를 쓰며, 이 로그는 이미지 작업마다 시간과 출처를 한 줄씩 출력합니다.
앱을 실행할 수 없으면 어떻게 하나요?
이 스킬은 변경 사항을 코드 읽기만 기반한 것으로 표시하고, 아직 측정되지 않았다고 밝히라고 안내합니다.
이전 Nuke 버전도 다루나요?
네. Nuke 14를 다루며, 13 버전과 무엇이 다른지도 설명합니다.
상세 정보
작성자의 원본 설명
Find out why images load slowly, scrolling stutters, memory grows, or the cache misses in an app that uses Nuke, and fix it. Use when asked to make images faster, to use less memory or data, to review how an app sets up Nuke, or to tune ImagePipeline, ImageCache, DataCache, ImagePrefetcher, or LazyImage. Covers Nuke 14, and what differs on 13.
repo: kean/Nuke
인기도
- GitHub 스타
- 8.7k
- 순위
- #12333
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
비슷한 스킬
android-clean-architecture
280k에이전트가 Android 프로젝트를 효율적으로 구성하도록 돕습니다. 유지보수와 새 기능 개발이 쉽도록 코드를 구조화합니다.
compose-multiplatform-patterns
280k에이전트가 KMP 프로젝트에서 Compose Multiplatform과 Jetpack Compose 패턴을 쓰도록 돕습니다. 상태, 내비게이션, 테마, 성능을 다룹니다.
dart-flutter-patterns
280kDart와 Flutter 앱용 코드를 작성하도록 에이전트를 돕습니다. 견고하고 관리하기 쉬운 앱을 만드는 현대적인 패턴을 씁니다.