Skip to content

1404 Fixing a few code performance issues#1423

Merged
wyli merged 6 commits intoProject-MONAI:masterfrom
de-sh:perf-deepsource
Jan 11, 2021
Merged

1404 Fixing a few code performance issues#1423
wyli merged 6 commits intoProject-MONAI:masterfrom
de-sh:perf-deepsource

Conversation

@de-sh
Copy link
Copy Markdown
Contributor

@de-sh de-sh commented Jan 10, 2021

part of #1404.

Description

As discussed in the discussion linked above, these issues were detected using the DeepSource static analyzer tool. These issues were specifically tagged and highlighted for their impact on the performance of MONAI, they are:

  • Pass string format arguments as logging method parameters
  • Remove unnecessary use of comprehension
  • Use literal syntax instead of function calls to create data structure

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh --codeformat --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

de-sh and others added 6 commits January 10, 2021 23:20
Signed-off-by: Devdutt Shenoi <devdutt@outlook.in>
Signed-off-by: Devdutt Shenoi <devdutt@outlook.in>
Signed-off-by: Devdutt Shenoi <devdutt@outlook.in>
Signed-off-by: Devdutt Shenoi <devdutt@outlook.in>
@wyli
Copy link
Copy Markdown
Contributor

wyli commented Jan 10, 2021

/integration-test

Copy link
Copy Markdown
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! i didn't check if the changes are exhaustive, but the changed ones are good.

@wyli wyli merged commit 3d5554f into Project-MONAI:master Jan 11, 2021
@de-sh de-sh deleted the perf-deepsource branch January 11, 2021 07:50
ericspod pushed a commit that referenced this pull request Apr 4, 2026
### Description
This change probably improves performance slightly (unforetunately, I
don't have a local instance of MONAI installed in order to test this,
but I'm pretty sure from looking at the code that using [], {} and
kwargs_[k] = _get_data(v) should be semantically the same and probably
slightly better in performance, see also #1423 (credits to @de-sh for
the nice fix 👍 ) where at least [] and {} were changed as a refactoring
and kwargs_[k] = _get_data(v) just seems better to me becuase I think
that this saves some time due to dictionary lookups and temporary
objects, but I'm not quite sure because it wasn't tested, so please
correct me if I'm mistaken).

A few sentences describing the changes proposed in this pull request.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: Benedikt Johannes <benedikt.johannes.hofer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants