# 使用Intel编译器(0)基础(3)循环相关的优化技术Loop optimization

30 篇文章 11 订阅

Loop optimization (wiki)：

1. Loop unwinding/loop unrolling/loop unroll循环展开

Loop unwinding, also known as loop unrolling, is a loop transformation technique that attempts to optimize a program's execution speed at the expense of its binary size (space-time tradeoff). The transformation can be undertaken manually by the programmer or by an optimizing compiler.

int x;
for (x = 0; x < 100; x++)
{
delete(x);
}

int x;
for (x = 0; x < 100; x+=5)
{
delete(x);
delete(x+1);
delete(x+2);
delete(x+3);
delete(x+4);
}

2. sectioning/loop-sectioning/strip-mining/strip mining

wiki没有找到专门介绍sectioning的页面，在上面的循环优化的wiki（http://en.wikipedia.org/wiki/Loop_optimization）中提到了此项优化技术如下：

loop-sectioning (also known as strip-mining) is a loop-transformation technique for enabling SIMD-encodings of loops and improving memory performance. This technique involves each vector operation being done for a size less than or equal to the maximum vector length on a given vector machine.

3. Loop interchange循环交换

In compiler theory, loop interchange is the process of exchanging the order of two iteration variables.

for(int i=0;i<M;i++)
for(int j=0;j<N;j++)
a[i][j]=i+j;

for(int j=0;j<N;j++)
for(int i=0;j<M;i++)
a[i][j]=i+j;

4. Loop blocking

loop blocking是intel编译器提供的一种优化技术，是strip mining和loop interchange的结合。

• 1
点赞
• 3
收藏
• 打赏
• 1
评论

gengshenghong

¥2 ¥4 ¥6 ¥10 ¥20

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。