Removal of `virtual` keywords from ConstNeighborhoodIterator

FYI, I did observe the ~18% reduction of run-time duration by running the following little program, before and after the patch (PERF: Removed all ‘virtual’ keywords from ConstNeighborhoodIterator):

#include <itkHoughTransform2DCirclesImageFilter.h>
#include <iostream>
#include <ctime>

int main()
{
  typedef unsigned char PixelType;
  const auto image = itk::Image<PixelType>::New();
  enum { sizeX = 19000, sizeY = sizeX };
  image->SetRegions({ sizeX, sizeY });
  image->Allocate();
  image->FillBuffer(1);

  const auto filter =
    itk::HoughTransform2DCirclesImageFilter<PixelType, unsigned char, double>::New();
  filter->SetInput(image);

  std::cout << "Start" << std::endl;
  const auto time1 = std::time(nullptr);
  filter->Update();
  const auto time2 = std::time(nullptr);

  std::cout << "Duration: " << (time2 - time1) << " seconds" << std::endl;
}

It was built by Visual C++ 2015 (Update 3), 64-bit, Release configuration. Before the patch, filter->Update() took at least 28 seconds on my machine (at work), while it could do it in 23 seconds after the patch. So I gained 5 seconds. 5/28 is about 18%.

I’m interested to hear from any of you if you can also observe that the patch yields such a significant performance improvement. If you have the time, please try to compile + run my little program before and after the patch, and tell us the result!

Note: the little test program here is an adapted version of the test program I posted at Hough Transform 2D Circles Image Filter GetCircles patch. just having a higher value for sizeX and sizeY.

2 Likes