JavaScript array iteration direction
<p>When processing a very large in-memory array of uniform (same-type) JavaScript objects (each with just a few columns)...</p>

<p>Is there any impact on performance and/or or any other penalty to consider when choosing to iterate through it as row->column versus column->row?</p>

<p><strong>Example</strong></p>

<p>We have 100,000 data rows from a CSV file, each is an object with 10 integer values, and we need to touch every value in it for a certain calculation.</p>

<p>Will it make any difference whether we iterate through it vertically or horizontally? Does the modern V8 care about such things in the slightest?</p>

<pre><code>var data = [...]; // array of many same-type objects;

// horizontal iteration:
for (var p in data[0]) {
    for (var i = 0; i &lt; data.length; i++) {
        var value = data[i][p]; // current value;
        // calculate here from the value;
    }
}

// vertical iteration:
for (var i = 0; i &lt; data.length; i++) {
    for (var p in data[0]) {
        var value = data[i][p]; // current value;
        // calculate here from the value;
    }
}
</code></pre>