blob: 80d7513f239e7dcc3072be8ccb6b99f5a142c0a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<!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>
|