Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图理解循环展开的概念,根据维基百科,它限制/最小化分支惩罚?
现在,我明白了循环展开是什么。它基本上是增加循环增量步骤,并重复循环内的语句。
但是,我不太明白这对分支惩罚有何帮助?
分支惩罚适用于每个分支。如果您将循环迭代 100 次,并且循环代码没有展开,那么您将支付 100 次分支惩罚。但如果循环展开一次(即代码的两个副本),您只需支付 50 次罚金。