Revision control

1
<script src="../resources/magnitude-perf.js"></script>
2
<script>
3
function setupFunction(magnitude)
4
{
5
array = [];
6
for (var i = 0; i < magnitude; i++) {
7
array[i] = i;
8
}
9
}
10
11
function test(magnitude)
12
{
13
for (var i = 0; i < array.length; i++) {
14
for (var j = 0; j < array.length; j++) {
15
var foo = array[i] + array[j];
16
}
17
}
18
}
19
20
Magnitude.description("Tests that doing a nested loop over an array is quadratic.");
21
Magnitude.run(setupFunction, test, Magnitude.POLYNOMIAL);
22
</script>