
Nuke Optimize
Find out why images load slowly, scrolling stutters, memory grows, or the cache misses...
Install
npx skills add kean/Nuke --skill nuke-optimize -g -a claude-code -y- Repository
- kean/Nuke8.7k
- Category
- Engineering
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
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.
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:
