Suzie1 / ComfyUI_Comfyroll_CustomNodes

Custom nodes for SDXL and SD1.5 including Multi-ControlNet, LoRA, Aspect Ratio, Process Switches, and many more nodes.
https://civitai.com/models/183551/comfyui-comfyroll-custom-nodes
634 stars 87 forks source link

Style Bars node is slow and memory intensive #100

Open Phen-Ro opened 9 months ago

Phen-Ro commented 9 months ago

When I use CR Style Bars, it takes several seconds to generate the image. I ran the code in CR_StyleBars's draw function line by line in python, and the slow lines are the the creation of the colors array (e.g., colors = (X // bar_width) % 2) and the call to plt.savefig.

The colors array takes ~3 seconds, and savefig takes ~4-5 seconds. There's also a noticeable bump in memory usage. This was with the default 512x512 image. If I go with 1024x1024, there's a huge spike in RAM usage and I have to kill the process before I run out of swap.

I don't have any problems using CR Color Bars, CR Color Gradient, or any of the others which use the same image creation technique. I believe I've tested all of them in the nodes_graphics_matplot.py file.

I'm not familiar enough with NumPy or Matplotlib to be of much help, so I'm afraid all you get is this bug report.

This was observed on a docker image using Ubuntu 22.04, Python 3.10.13, NumPy 1.26.2, and Matplotlib 3.8.2.

Suzie1 commented 9 months ago

yes, you are right, i'll ask Rocky to look at it