达夫循环
//达夫正向循环 function duffForwardLoop(items, process){ var idx = 0; var len = items.length; var itr = len >> 3; while (itr--) { process(items[idx++]); process(items[idx++]); process(items[idx++]); process(items[idx++]); process(items[idx++]); process(items[idx++]); process(items[idx++]); process(items[idx++]); } itr = len & 7; while (itr--) { process(items[idx++]); } } //达夫反向循环 function duffReverseLoop(items, process){ var len = items.length; var idx = len - 1; var itr = len >> 3; while (itr--) { process(items[idx--]); process(items[idx--]); process(items[idx--]); process(items[idx--]); process(items[idx--]); process(items[idx--]); process(items[idx--]); process(items[idx--]); } itr = len & 7; while (itr--) { process(items[idx--]); } }