function duffFasterLoop8(iterations) { // Original JS Implementation by Jeff Greenberg 2/2001 // http://home.earthlink.net/~kendrasg/info/js_opt/ // (fast duff's device) from an anonymous donor to Jeff Greenberg's site // (faster duff's defice) by Andrew King 8/2002 for WebSiteOptimization.com // bug fix (for iterations<8) by Andrew B. King April 12, 2003 var testVal=0; var n = iterations % 8; if (n>0) { do { testVal++; } while (--n); // n must be greater than 0 here } n = parseInt(iterations / 8); if (n>0) { // if iterations < 8 an infinite loop, added for safety in second printing do { testVal++; testVal++; testVal++; testVal++; testVal++; testVal++; testVal++; testVal++; } while (--n); // n must be greater than 0 here also } }