Hello everyone! Today, we’re diving into how to maximize ComfyUI performance with RTX 4090.
As AI workflows become increasingly demanding, many users are looking for ways to fully utilize their high-end GPUs. In this post, I’ll share the best optimization techniques to help you unlock the full potential of your RTX 4090, especially when working with heavy models like Flux.1 in ComfyUI.

🚀 Optimized ComfyUI Batch File for RTX 4090
First, let’s take a look at the optimized batch file that I’ve set up.
By default, ComfyUI comes with batch files like run_cpu.bat or run_nvidia_gpu.bat in its root folder.
Since we’re using an NVIDIA GPU, we’ll be editing the run_nvidia_gpu.bat file.

To optimize ComfyUI for RTX 4090, open run_nvidia_gpu.bat in Notepad or any text editor and replace its contents with the following:
.\python_embeded python.exe -s ComfyUI#main.py --windows-standalone-build --auto-launch --use-pytorch- cross-attention --cuda-malloc --use-stream --highvram
pause
This configuration ensures that RTX 4090 is fully utilized for AI image generation in ComfyUI.
Let’s break down what each of these options does and why it’s important!
💡 Explanation of Key ComfyUI Options & Their Effects
Option | Description | Effect |
---|---|---|
–windows-standalone-build | Runs ComfyUI as a standalone Windows build. | ✅ Optimizes execution within Windows and reduces unnecessary resource usage. |
–auto-launch | Automatically opens ComfyUI in the browser upon startup. | ✅ Saves time by eliminating the need to manually open the interface. |
–use-pytorch-cross-attention | Enables PyTorch Cross Attention optimization. | ✅ Enhances processing efficiency for complex AI models. |
–cuda-malloc | Optimizes CUDA memory allocation for better VRAM management. | ✅ Prevents memory bottlenecks when handling large models. |
–use-stream | Activates CUDA stream processing for better multi-threading. | ✅ Boosts parallel processing speed on RTX 4090. |
–highvram | Uses maximum VRAM capacity available on RTX 4090. | ✅ Allows stable performance even with high-resolution images. |
–fast | Optimizes float8_e4m3fn for Ada Lovelace GPUs (RTX 4000 series). | ✅ Significantly boosts performance (requires PyTorch 2.1+). |
–reserve-vram | Prevents ComfyUI from using all available VRAM. | ✅ Ensures stability when running multiple GPU-intensive applications. |
✨ Additional Options for RTX 4090
Option | Effect |
---|---|
–xformers | ✅ Speeds up inference and reduces VRAM usage. |
–force-fp16 | ✅ Forces FP16 precision to utilize Tensor Cores effectively. |
–no-half-vae | ✅ Uses FP32 for VAE, preventing quality loss in final renders. |
–disable-nan-check | ✅ Disables NaN validation, slightly boosting performance. |
📌 Ensuring PyTorch Compatibility
To fully utilize RTX 4090, you need the latest PyTorch version optimized for CUDA 11.8+.
Run the following command in Command Prompt to update:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
✅ Additional Optimization Tips
🔹 Install the latest PyTorch (2.1 or later)
🔹 Install CUDA 12.1 or later
🔹 Enable Xformers to boost speed by up to 30%
🔹 Ensure sufficient VRAM availability before running
By applying these settings, you can maximize the performance of the RTX 40 series, enabling faster and higher-quality AI image generation in ComfyUI!
I’ve also provided a link below where you can purchase an RTX 4090 series. If you’re running into VRAM limitations or need an RTX 4090 for your AI Image Generation or video contents, feel free to check it out!
–> RTX 4090 24GB OC Edition Gaming Graphics Card
🛠 Final Thoughts
With these settings, your RTX 4090 will be fully optimized for ComfyUI, ensuring fast image generation, stable VRAM usage, and maximum performance.
If you have an RTX 4090 with 24GB VRAM or a 40-series GPU with 12GB VRAM, you can modify the provided batch file settings to suit your specific needs.
By applying these optimizations, you can experience faster processing and peak performance for your AI content creation!
🔥 Try it out and let me know how well it works for you! Happy generating!
If you’re curious about how to use SDXL Turbo in ComfyUI, you can check the guide through the link below.