ComfyUI_Comfyroll_CustomNodes icon indicating copy to clipboard operation
ComfyUI_Comfyroll_CustomNodes copied to clipboard

Style Bars node is slow and memory intensive

Open Phen-Ro opened this issue 1 year ago • 1 comments

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.

Phen-Ro avatar Jan 07 '24 22:01 Phen-Ro

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

Suzie1 avatar Jan 08 '24 14:01 Suzie1