Commit 3635602c authored by Laszlo Domoszlai's avatar Laszlo Domoszlai

add browser based benchmarking framework

parent a338d23e
Pipeline #3815 skipped
This diff is collapsed.
<html>
<head>
<script src="underscore.js"></script>
<script src="lodash.js"></script>
<script src="platform.js"></script>
<script src="benchmark.js"></script>
<script type="text/javascript" src="..\..\..\Client\sapl-rt.js"></script>
<script type="text/javascript" src="..\..\..\Client\sapl-support.js"></script>
<script type="text/javascript" src="..\..\..\Client\builtin.js"></script>
<script type="text/javascript" src="..\..\..\Client\utils.js"></script>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript">
function run(){
var suite = new Benchmark.Suite;
suite.add('test', function() {
var expr = document.getElementById("expr").value;
var tmp;
eval("tmp = "+expr+";");
tmp = Sapl.toJS(tmp);
}, {minSamples: 3000})
// add listeners
.on('cycle', function(event) {
println(String(event.target));
})
.on('complete', function() {
// console.log('Fastest is ' + this.filter('fastest').map('name'));
// console.log('Slowest is ' + this.filter('slowest').map('name'));
})
// run async
.run(/*{ 'async': true }*/);
}
function run2(){
var start = new Date().getTime();
try{
var expr = document.getElementById("expr").value;
var tmp;
eval("tmp = "+expr+";");
tmp = Sapl.toJS(tmp);
var end = new Date().getTime();
println("");
println("-------------------------");
println("RETURN: "+tmp);
}catch(err){
console.log(err.stack);
println("ERROR: "+err);
}
println("-------------------------");
var time = end - start;
println('Execution time: ' + time);
}
</script>
</head>
<body>
Expression to run: <input type="text" size="50" id="expr" value="__main()"/>
<input type="button" value="Run" onclick="run()">
<br/><br/>
<div id="output"></div>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment