Why is ComfyUI slow after the first run

last edited

ComfyUI turns slow after the first run mostly because the memory manager evicts models, so a changed prompt or added adapter reloads them from disk, a common complaint. The ComfyUI fixes reached master in late July. The latest release is v0.45.0.

diskpinned ramgpudisk readprompt changessampling waits

Which causes and fixes explain slow repeat runs?

beforeunettevaedisk reloadafterunettevaestays pinnedpull requests 15027 and 15063
causesignfix
models evicted from RAMdisk reads after any prompt changeupdate, or use --cache-classic
dynamic VRAM regression8 to 20 minute LTX runs on 0.24 to 0.28update, or --disable-dynamic-vram
pinned memory crashread failed error, then CUDA OOM--cuda-device 0 or --disable-pinned-memory
slow or remote storagereload takes minutes on NAS or HDDkeep models on a local SSD

The prompt reload report has 121 comments. The root cause, per a maintainer summary, was non-dynamic code wiping the pinned RAM of dynamic models. Two pull requests merged, yet the issue shows as open.

Which startup flags speed up repeat runs?

--cache-classicold caching, fewer reloads--high-ramfills ram, may page--cache-ram a braise both thresholds--disable-dynamic-vramreloads stop for some--cache-nonereruns every nodeonly one cache mode at a time

The startup flag docs list --cache-classic for the old aggressive mode and --high-ram for machines with plenty of memory. The default --cache-ram mode keeps a tenth of system RAM active, with a floor of 2 GB. One user with 64 GB of RAM raised both thresholds and stopped the disk reads.

The --disable-dynamic-vram flag stopped reloads for several posters. Others saw no change. The --cache-none flag re-runs every node, so it suits debugging. Rolling back also worked for LTX users. One render took 26 minutes on the newer build, against about 5 on the older.

Is a slow first run normal?

first runsame promptnew promptloadsampling, about 53 s

A slow first run is normal. The first prompt reads checkpoints, encoders and VAEs from disk. Later runs reuse stored node results. In one Krea 2 test, the first load took 150 seconds. A repeat with the same prompt took 53. Compiled models add a one-time cost, called cold start in the PyTorch compile tutorials. Related: device problems, core design, hosting.

Sources