-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove/avoid redundant function calls #5280
Conversation
Signed-off-by: Marcel Bargull <[email protected]>
CodSpeed Performance ReportMerging #5280 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement Ken! 😀
Had a question on whether we can apply a similar strategy to some other code here
conda_build/variants.py
Outdated
loop_vars = [ | ||
k | ||
for k in variants[0] | ||
for k, v in first_variant.items() | ||
if k not in special_keys | ||
and ( | ||
not loop_only | ||
or any(variant[k] != variants[0][k] for variant in variants[1:]) | ||
) | ||
and (not loop_only or any(variant[k] != v for variant in other_variants)) | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this also be written in terms of set
s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a unittest and tinkered some more, see https://github.com/conda/conda-build/compare/6f0474b337583ef357e0244339df116d921940a4..40de0ae1c195ef9c3e6974630d576c96ea64506a
@deprecated.argument("24.5", "24.7", "loop_only") | ||
def get_vars(variants: Iterable[dict[str, Any]]) -> set[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opted to deprecate loop_only
since get_vars
is only invoked from one place and for that call loop_only=True
(see conda_build.metadata.MetaData.get_loop_vars
).
Description
Drive-by improvements:
set
operations instead offor
-loop +if
-clauseset.update
Split from:
extract_package_and_build_text
call #5253Checklist - did you ...
Add a file to thenews
directory (using the template) for the next release's release notes?Add / update necessary tests?Add / update outdated documentation?