| <!DOCTYPE html> |
| <script src="../resources/magnitude-perf.js"></script> |
| <script> |
| var key = 'counter'; |
| |
| function setupFunction(magnitude) |
| { |
| element = document.createElement('div'); |
| counter = 0; |
| } |
| |
| function test(magnitude) |
| { |
| element.setAttribute(key, counter ? counter-- : counter++); |
| } |
| |
| Magnitude.description("Tests that setAttribute is constant time."); |
| Magnitude.numTrials = 5; |
| Magnitude.successThreshold = 0.40; // 2 out of 5 |
| Magnitude.tolerance = 0.70; |
| Magnitude.trim = 2; |
| Magnitude.run(setupFunction, test, Magnitude.CONSTANT); |
| </script> |