<script src="../resources/magnitude-perf.js"></script> | |
<script> | |
function setupFunction(magnitude) | |
{ | |
array = []; | |
for (var i = 0; i < magnitude; i++) { | |
array[i] = i; | |
} | |
} | |
function test(magnitude) | |
{ | |
array.push(1); | |
array.pop(); | |
} | |
Magnitude.description("Tests that pushing and popping from an array is constant time."); | |
Magnitude.run(setupFunction, test, Magnitude.CONSTANT); | |
</script> |