@@ -879,7 +879,7 @@ def migrate_combined_spec(combined_spec, forge_dir, config, forge_config):
879879 return combined_spec
880880
881881
882- def reduce_variants (recipe_path , config , variants ):
882+ def reduce_variants (recipe_path , config , input_variants ):
883883 """Subset of render_recipe to compute reduced variant matrix
884884
885885 large numbers of unused variants greatly increase render time
@@ -892,7 +892,7 @@ def reduce_variants(recipe_path, config, variants):
892892 # from distribute_variants
893893 # explode variants dict to list of variants
894894 variants = initial_variants = conda_build .variants .get_package_variants (
895- metadata , variants = variants
895+ metadata , variants = input_variants
896896 )
897897 logger .debug (f"Starting with { len (initial_variants )} variants" )
898898 if metadata .noarch or metadata .noarch_python :
@@ -911,12 +911,20 @@ def reduce_variants(recipe_path, config, variants):
911911 metadata .config .variant = variants [0 ]
912912 metadata .config .variants = variants
913913 all_used = metadata .get_used_vars (force_global = True )
914- reduced_variants = metadata .get_reduced_variant_set (all_used )
915- logger .info (f"Rendering { len (reduced_variants )} variants" )
916- # return reduced, exploded list of variant dict to input format
917- return conda_build .variants .list_of_dicts_to_dict_of_lists (
918- reduced_variants
919- )
914+ new_input_variants = input_variants .copy ()
915+ # trim unused dimensions
916+ # these cost a lot in render_recipe!
917+ for key , value in list (input_variants .items ()):
918+ if len (value ) > 1 and key not in all_used | {
919+ "zip_keys" ,
920+ "pin_run_as_build" ,
921+ "ignore_build_only_deps" ,
922+ "extend_keys" ,
923+ }:
924+ logger .debug (f"Trimming unused dimension: { key } " )
925+ new_input_variants .pop (key )
926+ _trim_unused_zip_keys (new_input_variants )
927+ return new_input_variants
920928
921929
922930def _conda_build_api_render_for_smithy (
@@ -955,7 +963,7 @@ def _conda_build_api_render_for_smithy(
955963 # reduce unused variants first, they get very expensive in render_recipe
956964 if variants :
957965 variants = reduce_variants (
958- recipe_path , config = config , variants = variants
966+ recipe_path , config = config , input_variants = variants
959967 )
960968
961969 metadata_tuples = render_recipe (
0 commit comments