ComfyUI/comfy
codeflash-ai[bot] da2629c12c
️ Speed up function add_area_dims by 56%
To optimize the given function, we can avoid repeated slicing and concatenations within the loop, which can be computationally expensive, especially for large lists. Instead, we can split the list just once and construct the final result using list operations more efficiently.

Here's the optimized version of the program.



### Optimizations.
1. Calculate the current number of dimensions (`current_dims`) once before the loop.
2. Within the loop, use the `extend()` method to append parts of the `area` list efficiently rather than using concatenation (`+`) multiple times.
3. Use a single list construction operation to build the new area list in-place. 

This avoids the repeated creation of intermediary lists and makes the loop more efficient.
2025-04-22 00:55:23 +00:00
..
cldm Replace print with logging (#6138) 2024-12-20 16:24:55 -05:00
comfy_types Deprecate InputTypeOptions.defaultInput (#7551) 2025-04-10 06:57:06 -04:00
extra_samplers Uni pc sampler now works with audio and video models. 2025-01-18 05:27:58 -05:00
image_encoders Add support for giant dinov2 image encoder. 2025-03-17 05:53:54 -04:00
k_diffusion Add SEEDS (stage 2 & 3 DP) sampler (#7580) 2025-04-12 18:36:08 -04:00
ldm add RMSNorm to comfy.ops 2025-04-14 18:00:33 -04:00
sd1_tokenizer Initial commit. 2023-01-16 22:37:14 -05:00
t2i_adapter Controlnet refactor. 2024-06-27 18:43:11 -04:00
taesd Improvements to the TAESD3 implementation. 2024-06-16 02:04:24 -04:00
text_encoders Add an image_interleave option to the Hunyuan image to video encode node. 2025-03-07 19:56:26 -05:00
checkpoint_pickle.py Remove pytorch_lightning dependency. 2023-06-13 10:11:33 -04:00
cli_args.py Add CublasOps support (#7574) 2025-04-12 18:29:15 -04:00
clip_config_bigg.json Fix potential issue with non clip text embeddings. 2024-07-30 14:41:13 -04:00
clip_model.py Support llava clip vision model. 2025-03-06 00:24:43 -05:00
clip_vision_config_g.json Add support for clip g vision model to CLIPVisionLoader. 2023-08-18 11:13:29 -04:00
clip_vision_config_h.json Add support for unCLIP SD2.x models. 2023-04-01 23:19:15 -04:00
clip_vision_config_vitl_336_llava.json Support llava clip vision model. 2025-03-06 00:24:43 -05:00
clip_vision_config_vitl_336.json support clip-vit-large-patch14-336 (#4042) 2024-07-17 13:12:50 -04:00
clip_vision_config_vitl.json Add support for unCLIP SD2.x models. 2023-04-01 23:19:15 -04:00
clip_vision_siglip_384.json Support new flux model variants. 2024-11-21 08:38:23 -05:00
clip_vision_siglip_512.json Support 512 siglip model. 2025-04-05 07:01:01 -04:00
clip_vision.py Support 512 siglip model. 2025-04-05 07:01:01 -04:00
conds.py Remove unused function lcm in conds.py (#6572) 2025-01-23 05:54:09 -05:00
controlnet.py Use fp16 if checkpoint weights are fp16 and the model supports it. 2025-02-27 16:39:57 -05:00
diffusers_convert.py Remove useless code. 2025-01-24 06:15:54 -05:00
diffusers_load.py load_unet -> load_diffusion_model with a model_options argument. 2024-08-12 23:20:57 -04:00
float.py Clamp output when rounding weight to prevent Nan. 2024-10-19 19:07:10 -04:00
gligen.py Lint and fix undefined names (1/N) (#6028) 2024-12-12 18:55:26 -05:00
hooks.py Hooks Part 2 - TransformerOptionsHook and AdditionalModelsHook (#6377) 2025-01-11 12:20:23 -05:00
latent_formats.py Initial Hunyuan3Dv2 implementation. 2025-03-19 16:52:58 -04:00
lora_convert.py Support the wan fun reward loras. 2025-04-07 05:01:47 -04:00
lora.py Only use stable cascade lora format with cascade model. 2025-02-01 06:35:22 -05:00
model_base.py Remove useless code. 2025-03-29 20:12:56 -04:00
model_detection.py Native LotusD Implementation (#7125) 2025-03-21 14:04:15 -04:00
model_management.py MLU memory optimization (#7470) 2025-04-02 19:24:04 -04:00
model_patcher.py Call unpatch_hooks at the start of ModelPatcher.partially_unload (#7253) 2025-03-16 06:02:45 -04:00
model_sampling.py Automatically set the right sampling type for lotus. 2025-03-21 14:19:37 -04:00
ops.py add RMSNorm to comfy.ops 2025-04-14 18:00:33 -04:00
options.py Only parse command line args when main.py is called. 2023-09-13 11:38:20 -04:00
patcher_extension.py Add prepare_sampling wrapper allowing custom nodes to more accurately report noise_shape (#7500) 2025-04-09 09:43:35 -04:00
rmsnorm.py add RMSNorm to comfy.ops 2025-04-14 18:00:33 -04:00
sample.py Auto reshape 2d to 3d latent for single image generation on video model. 2024-12-29 02:26:49 -05:00
sampler_helpers.py Add prepare_sampling wrapper allowing custom nodes to more accurately report noise_shape (#7500) 2025-04-09 09:43:35 -04:00
samplers.py ️ Speed up function add_area_dims by 56% 2025-04-22 00:55:23 +00:00
sd1_clip_config.json Fix potential issue with non clip text embeddings. 2024-07-30 14:41:13 -04:00
sd1_clip.py Fix some things breaking when embeddings fail to apply. 2025-03-06 13:31:55 -05:00
sd.py Disable partial offloading of audio VAE. 2025-04-04 21:24:56 -04:00
sdxl_clip.py Make it easier to set a custom template for hunyuan video. 2025-03-04 09:26:05 -05:00
supported_models_base.py Mixed precision diffusion models with scaled fp8. 2024-10-21 18:12:51 -04:00
supported_models.py Support the WAN 2.1 fun control models. 2025-03-26 19:54:54 -04:00
utils.py Support LTXV 0.9.5. 2025-03-05 00:13:49 -05:00