This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
forked from CMGStudios/luaparse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmarks.html
71 lines (60 loc) · 1.95 KB
/
benchmarks.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Luaparse benchmarks</title>
<link rel="stylesheet" href="lib/mocha/mocha.css">
<style>
.hidden { display: none; }
</style>
</head>
<body>
<button id="run" class="hidden">Run</button>
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.1/require.min.js"></script>
<script>
window.key = 'agt1YS1wcm9maWxlcnINCxIEVGVzdBiS6aETDA';
window.commit = '33e3a';
window._bTestResults = {};
window.resultPath = 'http://www.browserscope.org/user/tests/table/' + window.key + '?v=3';
window.beaconPath = 'http://www.browserscope.org/user/beacon/' + window.key;
requirejs.config({
paths: {
benchmark: 'lib/benchmark'
, jquery: 'http://code.jquery.com/jquery-1.8.3.min'
, luaparse: '../luaparse'
, text: 'https://github.com/requirejs/text/raw/master/text'
}
});
require([
'jquery'
, 'benchmark'
, 'luaparse'
, 'text!../benchmarks/lib/ParseLua.lua'
], function($, Benchmark, parser, luaminify) {
var suite = new Benchmark.Suite();
$('#run')
.removeClass('hidden')
.on('click', function() {
$(this).addClass('hidden');
suite.run();
});
suite.add(window.commit, function() {
parser.parse(luaminify);
});
suite.on('cycle', function(e) {
setResult(window.commit, e.target.hz);
});
suite.on('complete', function(e) {
$('<script src="' + window.beaconPath + '" />')
.appendTo($('body'));
$('#run').replaceWith('<p>' + e.target.toString() + '</p>');
});
function setResult(name, hz) {
window._bTestResults[name] = Math.round(hz);
}
$('<iframe src="' + window.resultPath + '" style="border:0; width: 100%; height: 500px;" />')
.appendTo($('body'));
});
</script>
</body>
</html>