For service pack 1, Microsoft has introduced a new heuristic based on code size and whether or not the call is in a loop.
在Service Pack 1中,微软引入了一个新的基于代码尺寸的启发式算法,来判断调用是否处于一个循环中。
Surprising results show that if you implement sizeof there is almost no difference in whether calculating the size of a loop in advance.
很奇怪的结果表明,如果你执行size of,那么是否预先计算循环的次数基本上没有什么区别。
So when the program starts to loop through the files, perhaps to determine the directories overall size, it has to requery the file system one by one.
所以,在程序开始遍历这些文件的时候,假设为了确定目录的总大小,就必须逐一重新查询文件系统。
Now this happens to be what we would call a linear process, because the number of times I go around the loop is directly related to the size of the argument. If I double 2 the argument, I'm going to double the number of times I go around the loop. If I increase it by five, 5 I'm going to increase by five the number of times I go around the loop.
这恰好是我们会成为,线性复杂度程序的一个例子,因为我要执行循环的次数是,和输入的参数的大小直接相关的,如果我将这个参数乘以,那么我就要将进行循环的次数也乘以2了,如果我把参数加上,那么循环的次数也要加上5了。
应用推荐