You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[EHNANCEMENT] Better Performance For engines/utils.py #8806
In PrepareBatchExtraInput.__call__ (monai/engines/utils.py), replace the args_ list + for loop with a direct generator expression passed to tuple(), and replace kwargs_.update({k: ...}) with a dict comprehension — exactly as @ericspod suggested in the resolved review comment on Slightly improve performance in engines/utils.py #8747.
Add/update the existing unit tests in tests/engines/test_utils.py to cover the refactored path.
This is a non-breaking refactor (semantically identical, slightly more efficient). Does this match what you had in mind?
Activity
Zeesejo commentedon Apr 17, 2026
Hi @benediktjohannes and @ericspod, I'd like to implement the suggestion from @ericspod in #8747.
My plan:
PrepareBatchExtraInput.__call__(monai/engines/utils.py), replace theargs_list +forloop with a direct generator expression passed totuple(), and replacekwargs_.update({k: ...})with a dict comprehension — exactly as @ericspod suggested in the resolved review comment on Slightly improve performance in engines/utils.py #8747.tests/engines/test_utils.pyto cover the refactored path.This is a non-breaking refactor (semantically identical, slightly more efficient). Does this match what you had in mind?
enh(engines/utils): use tuple/dict comprehensions in PrepareBatchExtr…
ericspod commentedon Apr 19, 2026
Hi @Zeesejo I'm fine for you to go ahead, I should see the PR once it's ready.
benediktjohannes commentedon Apr 19, 2026
Perfect, thank you!