-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqweb-benchmark.html
57 lines (51 loc) · 1.65 KB
/
qweb-benchmark.html
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html style="height: 100%">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="qweb.js"></script>
<script type="text/javascript" src="qweb2.js"></script>
<script type="text/javascript">
(function (c) {
if (c.time) { return; }
var d = {};
c.time = function (key) {
d[key] = Date.now();
};
c.timeEnd = function (key) {
var end = Date.now(),
origin = d[key];
delete d[key];
if (!origin) { return; }
console.log(key + ': ' + (end - origin) + 'ms');
};
})(window.console);
var dict = {
session : true,
testing : 'yes',
name : 'AGR'
};
console.time("Load template with QWeb");
QWeb.add_template("qweb-benchmark.xml");
console.timeEnd("Load template with QWeb");
console.time("Load template with QWeb2");
var engine = new QWeb2.Engine("qweb-benchmark.xml")
engine.debug = true;
console.timeEnd("Load template with QWeb2")
var iter = 1000;
console.log("Rendering...");
console.time("Render " + iter + " templates with QWeb");
for (var i = 0; i < iter; i++) {
var qweb = QWeb.render('benchmark', dict);
}
console.timeEnd("Render " + iter + " templates with QWeb");
console.time("Render " + iter + " templates with QWeb2");
for (var i = 0; i < iter; i++) {
var qweb2 = engine.render('benchmark', dict);
}
console.timeEnd("Render " + iter + " templates with QWeb2");
</script>
</head>
<body>
Please, check your console for results
</body>
</html>