-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
PERF: Make ImageRegion
trivially copyable, remove inheritance (ITK_FUTURE_LEGACY_REMOVE
)
#4344
PERF: Make ImageRegion
trivially copyable, remove inheritance (ITK_FUTURE_LEGACY_REMOVE
)
#4344
Conversation
ImageRegion
lightweight and trivially copyableImageRegion
lightweight and trivially copyable
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.
Let's see how testing goes.
itk::Region
itself is not much used. Did you consider making it trivially copyable? That way we could keep the inheritance.
Technically that might work as well, but it's a bit risky to keep the inheritance, when we make My feeling is that the |
33ddd3d
to
7fead70
Compare
Interestingly, only when
A fix is included with this pull request. Update, November 24, 2023: Those warnings are now addressed by a separate pull request: |
7fead70
to
67c415a
Compare
67c415a
to
d73f19a
Compare
d73f19a
to
05a3426
Compare
I would consider this a breaking API change, that is only suitable for a major revision. |
Thanks Bradley, good point. This is indeed an API change. Which specific ITK revision could then include a change like this? |
Perhaps make it future legacy? So it becomes legacy in 6.0 (soon), and gets removed in 7.0. |
05a3426
to
b4112d0
Compare
ImageRegion
lightweight and trivially copyableImageRegion
trivially copyable, remove inheritance (ITK_FUTURE_LEGACY_REMOVE
)
Reverted status to "work in progress", because I would prefer to first see the related ("spin-off") pull request being processed: (Afterwards I would rebase this one.) |
Made `ImageRegion` more lightweight, by declaring all of its member functions non-virtual, and by removing its inheritance from `Region`, when `ITK_FUTURE_LEGACY_REMOVE` is enabled. The size of `ImageRegion<2>` was observed to go down from 40 bytes (before this commit) to 32 bytes (after this commit), on Visual C++ 2022 (x64). A run-time performance improvement of more than 25% on default-constructing and destructing a sequence of `ImageRegion` objects was observed, by benchmarking `std::make_unique<itk::ImageRegion<2>[]>(n)`.
b4112d0
to
1f3bbb6
Compare
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.
🚀 🔥
@N-Dekker very nice!
Note: the previously failing first-interaction
check is now fixed via actions/first-interaction#287
Replaced `ITK_FUTURE_LEGACY_REMOVE` with `ITK_LEGACY_REMOVE`, regarding its inheritance from `itk::Region`. A run-time performance improvement of more than 25% on default-constructing and destructing a sequence of `ImageRegion` objects was observed. - Follow-up to pull request InsightSoftwareConsortium#4344 commit 1f3bbb6
Replaced `ITK_FUTURE_LEGACY_REMOVE` with `ITK_LEGACY_REMOVE`, regarding its inheritance from `itk::Region`. A run-time performance improvement of more than 25% on default-constructing and destructing a sequence of `ImageRegion` objects was observed. - Follow-up to pull request InsightSoftwareConsortium#4344 commit 1f3bbb6
Made all member functions of
ImageRegion
non-virtual, and removed its inheritance fromRegion
.The size of
ImageRegion<2>
was observed to go down from 40 bytes (before this commit) to 32 bytes (after this commit), on Visual C++ 2022 (x64). A run-time performance improvement of more than 25% on default-constructing and destructing a sequence ofImageRegion
objects was observed, by benchmarkingstd::make_unique<itk::ImageRegion<2>[]>(n)
.