summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/speed/string_format.html
blob: 39146b7ed8d8c7b81d889e83bfffbae5de4d17b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html>
<head>
<script src="../../lib/OpenLayers.js"></script>
<script>

function stringformat() {
  var string = OpenLayers.String.format("${abc} 123 ${def}", {'abc': 456, 'def': 789}) 
}    
function run(x) {
    var date = new Date();
    for (var i = 0; i < x; i++) {
        stringformat();
    }
    var elapsed = (new Date() - date);
    return elapsed;
}

function show_time(x) 
{
    var t = run(x);
    document.getElementById("out").innerHTML = t + "ms  for " + x + " runs";
}
</script>
</head>
<body>
<a onclick="javascript:show_time(100000); return false" href="#">Run</a>
<div id="out"></div>
</body>
</html>