OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <script src="../resources/magnitude-perf.js"></script> | |
3 <script> | |
4 var key = 'counter'; | |
5 | |
6 function setupFunction(magnitude) | |
7 { | |
8 element = document.createElement('div'); | |
9 counter = 0; | |
10 } | |
11 | |
12 function test(magnitude) | |
13 { | |
14 element.setAttribute(key, counter ? counter-- : counter++); | |
15 } | |
16 | |
17 Magnitude.description("Tests that setAttribute is constant time."); | |
18 Magnitude.numTrials = 5; | |
19 Magnitude.successThreshold = 0.40; // 2 out of 5 | |
20 Magnitude.tolerance = 0.70; | |
21 Magnitude.trim = 2; | |
22 Magnitude.run(setupFunction, test, Magnitude.CONSTANT); | |
23 </script> | |
OLD | NEW |