Skip to content

[EHNANCEMENT] Better Performance For engines/utils.py #8806

Open

Description

@benediktjohannes

I‘m creating this so that we don’t forget about the enhancement proposal by @ericspod in #8747 (thank you Eric for the Suggestion!)

Activity

  1. Zeesejo commented on Apr 17, 2026

    @Zeesejo
    Contributor

    Hi @benediktjohannes and @ericspod, I'd like to implement the suggestion from @ericspod in #8747.

    My plan:

    1. 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.
    2. 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?

  2. added a commit that references this issue on Apr 17, 2026
    4d4c7f6
  3. ericspod commented on Apr 19, 2026

    @ericspod
    Member

    Hi @Zeesejo I'm fine for you to go ahead, I should see the PR once it's ready.

  4. benediktjohannes commented on Apr 19, 2026

    @benediktjohannes
    ContributorAuthor

    Perfect, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions