OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html><head> |
| 3 <meta charset="utf-8"> |
| 4 <link rel="stylesheet" type="text/css" href="../unit.css" /> |
| 5 <script type="application/x-javascript" src="../unit.js"></script> |
| 6 <script type="application/x-javascript" src="../util.js"></script> |
| 7 <script type="application/x-javascript"> |
| 8 |
| 9 Tests.autorun = false; |
| 10 Tests.message = "This might take a second or two"; |
| 11 |
| 12 Tests.testGLOverhead = function() { |
| 13 var gl = document.getElementById("gl").getContext(GL_CONTEXT_ID); |
| 14 var fakeGl = {getError: function(){ return 0; }}; |
| 15 time("testGLOverhead", function() { |
| 16 for (var i=0; i<1000000; i++) |
| 17 gl.getError(); |
| 18 }); |
| 19 time("testJSOverhead", function() { |
| 20 for (var i=0; i<1000000; i++) |
| 21 fakeGl.getError(); |
| 22 }); |
| 23 time("testLoopOverhead", function() { |
| 24 for (var i=0; i<1000000;) |
| 25 i++; |
| 26 }); |
| 27 } |
| 28 |
| 29 </script> |
| 30 <style>canvas{ position:absolute; }</style> |
| 31 </head><body> |
| 32 <canvas id="gl" width="16" height="16"></canvas> |
| 33 <h3>1000000x gl.getError() (measuring JS->GL call overhead)</h3> |
| 34 <p id="testGLOverhead"></p> |
| 35 <h3>1000000x fakeGl.getError() (measuring JS->JS call overhead)</h3> |
| 36 <p id="testJSOverhead"></p> |
| 37 <h3>1000000x i++ (measuring loop overhead)</h3> |
| 38 <p id="testLoopOverhead"></p> |
| 39 </body></html> |
| 40 |
OLD | NEW |