Ineffective “Peel/Remainder” Loop in my code

后端 未结 1 1734
予麋鹿
予麋鹿 2021-01-24 09:15

I have this function:

bool interpolate(const Mat &im, float ofsx, float ofsy, float a11, float a12, float a21, float a22, Mat &res)
{         
   bool re         


        
相关标签:
1条回答
  • 2021-01-24 09:48

    First, you have to check Vector Advisor Efficiency metric as well as relative time spent in Loop Remainder compared to Loop Body (see hotspots list in advisor). If efficiency is close to 100% (or time spent in Remainder is very small), then it is not worth effort (and money as MSalters mentioned in comments).

    If it is << 100% (and there are no other penalties reported by the tool), then you can either refactor the code to "add fake iterations" (rare users can afford it) or you should try #pragma loop_count for most typical #iterations values (depending on typical halfWidth value).

    If halfWIdth is totally random (no common or average values), then there is nothing you can really do with this issue.

    0 讨论(0)
提交回复
热议问题