gecko/content/canvas/test/webgl/more/performance/jsToGLOverhead.html

41 lines
1.3 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../unit.css" />
<script type="application/x-javascript" src="../unit.js"></script>
<script type="application/x-javascript" src="../util.js"></script>
<script type="application/x-javascript">
Tests.autorun = false;
Tests.message = "This might take a second or two";
Tests.testGLOverhead = function() {
var gl = document.getElementById("gl").getContext(GL_CONTEXT_ID);
var fakeGl = {getError: function(){ return 0; }};
time("testGLOverhead", function() {
for (var i=0; i<1000000; i++)
gl.getError();
});
time("testJSOverhead", function() {
for (var i=0; i<1000000; i++)
fakeGl.getError();
});
time("testLoopOverhead", function() {
for (var i=0; i<1000000;)
i++;
});
}
</script>
<style>canvas{ position:absolute; }</style>
</head><body>
<canvas id="gl" width="16" height="16"></canvas>
<h3>1000000x gl.getError() (measuring JS->GL call overhead)</h3>
<p id="testGLOverhead"></p>
<h3>1000000x fakeGl.getError() (measuring JS->JS call overhead)</h3>
<p id="testJSOverhead"></p>
<h3>1000000x i++ (measuring loop overhead)</h3>
<p id="testLoopOverhead"></p>
</body></html>