Latency bounds and throughput bounds for processors for operations that must occur in sequence

Terminology: you can say a loop is “bound on latency”, but when analyzing that bottleneck I wouldn’t say “the latency bound” or “bounds”. That sounds wrong to me. The thing you’re measuring (or calculating via static performance analysis) is the latency or length of the critical path, or the length of the loop-carried dependency chain. … Read more

When, if ever, is loop unrolling still useful?

Loop unrolling makes sense if you can break dependency chains. This gives a out of order or super-scalar CPU the possibility to schedule things better and thus run faster. A simple example: for (int i=0; i<n; i++) { sum += data[i]; } Here the dependency chain of the arguments is very short. If you get … Read more

Is reading the `length` property of an array really that expensive an operation in JavaScript?

Well, I would have said it was expensive, but then I wrote a little test @ jsperf.com and to my surprise using i<array.length actually was faster in Chrome, and in FF(4) it didn’t matter. My suspicion is that length is stored as an integer (Uint32). From the ECMA-specs (262 ed. 5, page 121): Every Array … Read more

tech