-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
Major performance issue TimeProbe, ResourceProbe constructor #350
Comments
@hyunjaeKang I think this issue is related to an ITK contribution of yours, right? Can you please have a look? Specifically, do you think it would be OK to remove the |
Update: I'm preparing a fix for this issue... please wait! |
ITK 4.9 added system info to `itk::ResourceProbe` (the base class of `itk::TimeProbe` and `itk::MemoryProbe`), by calling `GetSystemInformation()` in its constructor. This function call appeared very time consuming. Using Visual Studio 2017 (Release configuration), it was observed that a single `GetSystemInformation()` function call took more than 0.1 second. This commit removes the `this->GetSystemInformation()` function call from ResourceProbe, deprecates the member function, removes the related data members, and only retrieves the system info when and where it is actually being used: in `PrintSystemInformation` and `PrintJSONSystemInformation`. Fixes issue #350, "Major performance issue TimeProbe, ResourceProbe constructor", which was based on the analysis of an `elastix` example case by Theo van Walsum (@tvanwalsum).
Thank you very much for approving and merging pull request #351 to the master branch, @hjmjohnson . I usually don't ask this but would it be possible to also apply this fix to ITK 4? @thewtex ? I feel this fix could also be of interest to those ITK users who cannot yet move forward to ITK5/C++11. |
To do that, you should cherry-pick this patch on top of |
Thanks @dzenanz Are there still plans for another ITK 4 release? |
Yes, there are plans for at last one more 4.13.x release. |
@dzenanz Thanks, I'll ask around here at LUMC if people care about having this performance fix in ITK4. |
…ightSoftwareConsortium#350 ITK 4.9 added system info to `itk::ResourceProbe` (the base class of `itk::TimeProbe` and `itk::MemoryProbe`), by calling `GetSystemInformation()` in its constructor. This function call appeared very time consuming. Using Visual Studio 2017 (Release configuration), it was observed that a single `GetSystemInformation()` function call took more than 0.1 second. This commit removes the `this->GetSystemInformation()` function call from ResourceProbe, deprecates the member function, removes the related data members, and only retrieves the system info when and where it is actually being used: in `PrintSystemInformation` and `PrintJSONSystemInformation`. Fixes issue InsightSoftwareConsortium#350, "Major performance issue TimeProbe, ResourceProbe constructor", which was based on the analysis of an `elastix` example case by Theo van Walsum (@tvanwalsum).
PERF: Remove SystemInformation data from ResourceProbe, fix issue #350
Follow-up to: "PERF: Remove SystemInformation data from ResourceProbe, fix issue InsightSoftwareConsortium#350" Pull request InsightSoftwareConsortium#351 Commit 747f3d1, 2018-12-24
Follow-up to: "PERF: Remove SystemInformation data from ResourceProbe, fix issue InsightSoftwareConsortium#350" Pull request InsightSoftwareConsortium#351 Commit 747f3d1, 2018-12-24
Follow-up to: "PERF: Remove SystemInformation data from ResourceProbe, fix issue InsightSoftwareConsortium#350" Pull request InsightSoftwareConsortium#351 Commit 747f3d1, 2018-12-24
Follow-up to: "PERF: Remove SystemInformation data from ResourceProbe, fix issue InsightSoftwareConsortium#350" Pull request InsightSoftwareConsortium#351 Commit 747f3d1, 2018-12-24
Two weeks ago, Theo van Walsum (@tvanwalsum, Erasmus MC, Rotterdam) reported a major performance issue at discourse.itk.org:
While Theo encountered the issue with ITK 4.8, using VS2013, it is still there with ITK 5 beta 3, using VS2017.
It appears that this performance issue is caused by an enhancement of itk::ResourceProbe, introduced with ITK 4.9. This enhancement includes calling
GetSystemInformation()
in the default-constructor ofResourceProbe
: https://github.com/InsightSoftwareConsortium/ITK/blob/v4.9.0/Modules/Core/Common/include/itkResourceProbe.hxx#L51 Which causes a major performance drop of its derived classes, includingitk::TimeProbe
.It can be reproduced by profiling the following example:
On Visual Studio 2017 Version 15.9.4 64-bit Release, I observed that this code takes more than 25 seconds. When I manually remove the
GetSystemInformation()
call from the default-constructor of ResourceProbe (at https://github.com/InsightSoftwareConsortium/ITK/blob/v5.0b03/Modules/Core/Common/include/itkResourceProbe.hxx#L52), the very same code takes less than 0.001 seconds!The text was updated successfully, but these errors were encountered: