for (int i = 0; i < 5000; i++)
for (int j = 0; j < 5000; j++)
{
for (int ii = 0; ii < 20; ii++)
for (int jj = 0; jj < 20; jj++)
{
int num = matBigger[i+ii][j+jj];
// Extract range from this.
int low = num & 0xff;
int high = num >> 8;
if (low < matSmaller[ii][jj] && matSmaller[ii][jj] > high)
// match found
}
}
该机器是 x86_64,32kb L1 cahce,256 Kb L2 缓存。
关于如何优化此代码的任何指示?
编辑原始问题的一些背景:Fastest way to Find amxn submatrix in MXN matrix