# Nuke Optimize

Find out why images load slowly, scrolling stutters, memory grows, or the cache misses...

- Repository: https://github.com/kean/Nuke (8688 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add kean/Nuke --skill nuke-optimize -g -a claude-code -y`
Codex: `npx skills add kean/Nuke --skill nuke-optimize -g -a codex -y`
Cursor: `npx skills add kean/Nuke --skill nuke-optimize -g -a cursor -y`
Gemini CLI: `npx skills add kean/Nuke --skill nuke-optimize -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add kean/Nuke`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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:

```bash
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](#cache-keys), [Disk cache](#disk-cache) |
| `from httpCache`, and tens of ms | `URLCache` asked the server whether the image changed | [Disk cache](#disk-cache) |
| `MB in memory` over width × height × 4 of the cell, in pixels | The image is bigger than what's displayed | [Decode less](#decode-less) |
| The same URL twice, with no `coalesced` | Two requests that differ, so nothing is shared | [Cache keys](#cache-keys), [Prefetching](#prefetching) |
| More lines than cells on screen, on open | Everything loads at once | [Load only what's on screen](#load-only-whats-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:

The rest: https://github.com/kean/Nuke/blob/HEAD/skills/nuke-optimize/SKILL.md
