PERF: Make ImageRegion trivially copyable, remove inheritance (ITK_FUTURE_LEGACY_REMOVE)#4344
Conversation
ImageRegion lightweight and trivially copyableImageRegion lightweight and trivially copyable
dzenanz
left a comment
There was a problem hiding this comment.
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
thewtex
left a comment
There was a problem hiding this comment.
🚀 🔥
@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
ImageRegionnon-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 ofImageRegionobjects was observed, by benchmarkingstd::make_unique<itk::ImageRegion<2>[]>(n).