[Insight-developers] Performance Impact of using GetInput

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Jul 3 10:26:02 EDT 2012


Hello,

A user yesterday, was reporting that going from ITK 3.20 to ITK 4.1, the SignedMaurerDistanceMapImageFilter was running more that 2x-3x the time. With a little bit of poking around and sampling the run time, I was able to develop the following patch:

http://review.source.kitware.com/#/c/6367/

I find that difference to be quite significant difference, and is on the level of a bug.

The lead me to wonder how wide spread is this incorrect usage. So I added an atomic counter to the GetInput, and GetOutput methods, and when they exceed a threshold, an exception is throw. This is to detect when these methods may be used in an inner loop.

http://review.source.kitware.com/#/c/6369/


I get the following test failure (where previously there was none):


97% tests passed, 71 tests failed out of 2382

The following tests FAILED:
	160 - itkN4BiasFieldCorrectionImageFilterTest1 (Failed)
	161 - itkN4BiasFieldCorrectionImageFilterTest2 (Failed)
	311 - itkMultiThreaderEnvTest88 (Failed)
	313 - itkMultiThreaderEnvTest123 (Failed)
	398 - itkFFTConvolutionImageFilterTest4x4Mean (Failed)
	399 - itkFFTConvolutionImageFilterTest4x5Mean (Failed)
	400 - itkFFTConvolutionImageFilterTest5x5Mean (Failed)
	401 - itkFFTConvolutionImageFilterTest4x4MeanValidRegion (Failed)
	402 - itkFFTConvolutionImageFilterTest4x5MeanValidRegion (Failed)
	403 - itkFFTConvolutionImageFilterTest5x5MeanValidRegion (Failed)
	420 - itkRichardsonLucyDeconvolutionImageFilterGaussianKernelTest (Failed)
	421 - itkRichardsonLucyDeconvolutionImageFilterIrregularKernelTest (Failed)
	422 - itkLandweberDeconvolutionImageFilterGaussianKernelTest (Failed)
	423 - itkLandweberDeconvolutionImageFilterIrregularKernelTest (Failed)
	425 - itkProjectedLandweberDeconvolutionImageFilterGaussianKernelTest (Failed)
	426 - itkProjectedLandweberDeconvolutionImageFilterIrregularKernelTest (Failed)
	427 - itkInverseDeconvolutionImageFilterGaussianKernelTest (Failed)
	428 - itkInverseDeconvolutionImageFilterIrregularKernelTest (Failed)
	429 - itkTikhonovDeconvolutionImageFilterGaussianKernelTest (Failed)
	430 - itkTikhonovDeconvolutionImageFilterIrregularKernelTest (Failed)
	431 - itkWienerDeconvolutionImageFilterGaussianKernelTest (Failed)
	432 - itkWienerDeconvolutionImageFilterIrregularKernelTest (Failed)
	433 - itkParametricBlindLeastSquaresDeconvolutionImageFilterTest (Failed)
	436 - itkDeformableSimplexMesh3DBalloonForceFilterTest (Failed)
	440 - itkPatchBasedDenoisingImageFilterTest0 (Failed)
	441 - itkPatchBasedDenoisingImageFilterTestGaussian (Failed)
	442 - itkPatchBasedDenoisingImageFilterTestRician (Failed)
	443 - itkPatchBasedDenoisingImageFilterTestPoisson (Failed)
	521 - itkDisplacementFieldToBSplineImageFilterTest (Failed)
	524 - itkContourMeanDistanceImageFilterTest (Failed)
	525 - itkContourDirectedMeanDistanceImageFilterTest (Failed)
	530 - itkHausdorffDistanceImageFilterTest (Failed)
	532 - itkSignedMaurerDistanceMapImageFilterTest1 (Failed)
	533 - itkSignedMaurerDistanceMapImageFilterTest2 (Failed)
	656 - itkFastMarchingImageFilterTest_torus_multipleSeeds_NoTopo (Failed)
	657 - itkFastMarchingImageFilterTest_torus_multipleSeeds_StrictTopo (Failed)
	658 - itkFastMarchingImageFilterTest_torus_multipleSeeds_NoHandlesTopo (Failed)
	659 - itkFastMarchingImageFilterTest_wm_multipleSeeds_NoTopo (Failed)
	660 - itkFastMarchingImageFilterTest_wm_multipleSeeds_StrictTopo (Failed)
	661 - itkFastMarchingImageFilterTest_wm_multipleSeeds_NoHandlesTopo (Failed)
	1072 - itkBSplineControlPointImageFilterTest2 (Failed)
	1079 - itkCyclicShiftImageFilterTest0 (Failed)
	1080 - itkCyclicShiftImageFilterTest1 (Failed)
	1081 - itkCyclicShiftImageFilterTest2 (Failed)
	1082 - itkCyclicShiftImageFilterTest3 (Failed)
	1083 - itkCyclicShiftImageFilterTest4 (Failed)
	1084 - itkCyclicShiftImageFilterTest5 (Failed)
	1085 - itkCyclicShiftImageFilterTest6 (Failed)
	1195 - itkModulusImageFilterTest (Failed)
	1377 - itkExtensionVelocitiesImageFilterTest (Failed)
	1378 - itkCannySegmentationLevelSetImageFilterTest (Failed)
	1412 - itkTwoLevelSetsv4DenseImage2DTest (Failed)
	1471 - itkSimplexMeshVolumeCalculatorTest (Failed)
	1659 - itkBinaryMask3DQuadEdgeMeshSourceTest (Failed)
	1747 - itkPointSetToPointSetRegistrationTest (Failed)
	1774 - itkDiffeomorphicDemonsRegistrationFilterTest01 (Failed)
	1775 - itkDiffeomorphicDemonsRegistrationFilterTest02 (Failed)
	1776 - itkDiffeomorphicDemonsRegistrationFilterTest03 (Failed)
	1777 - itkDiffeomorphicDemonsRegistrationFilterTest04 (Failed)
	1778 - itkDiffeomorphicDemonsRegistrationFilterTest05 (Failed)
	1779 - itkDiffeomorphicDemonsRegistrationFilterTest06 (Failed)
	1780 - itkDiffeomorphicDemonsRegistrationFilterTest07 (Failed)
	1781 - itkDiffeomorphicDemonsRegistrationFilterTest08 (Failed)
	1782 - itkDiffeomorphicDemonsRegistrationFilterTest09 (Failed)
	1783 - itkDiffeomorphicDemonsRegistrationFilterTest10 (Failed)
	1784 - itkDiffeomorphicDemonsRegistrationFilterTest11 (Failed)
	1802 - itkFastSymmetricForcesDemonsRegistrationFilterTest (Failed)
	2166 - itkVoronoiSegmentationImageFilterTest (Failed)


How big of a deal if most of the filters here are running 2x+ slower then what they should be? Is it big enough to delay the Release and do another RC with the fixes?

I have also been looking at the methods used in GetInput, specifically the methods used to create the std::string... It seems to be if we change the return value to a const std::string &, then we could keep a static internal table of the common value and return reference to the static table to even, references to what is in the std::map, the would reduce the need for mallocs for std::string.

Thoughts on what to do?

Brad

========================================================
Bradley Lowekamp  
Medical Science and Computing for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120703/69091dc5/attachment.htm>


More information about the Insight-developers mailing list