forked from mattgodbolt/jsbeeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
perf-test.html
30 lines (29 loc) · 855 Bytes
/
perf-test.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Title</title>
<script type="text/javascript">
function test() {
function tst(fb32, destOffset, numPixels) {
var black = 0xff000000;
while (numPixels--) {
fb32[destOffset++] = black;
}
}
var fb32 = new Uint32Array(1024);
var reps = 500000;
var start = Date.now();
for (var i = 0; i < reps; ++i) tst(fb32, 0, 16);
var end = Date.now();
var result = "Took " + (end - start) + "ms to do " + reps + " 16 32-bit clears";
console.log(result);
document.getElementById("result").innerHTML = result;
}
</script>
</head>
<body onload="test()">
<h2>Test</h2>
<div><span id="result">Running test....</span></div>
</body>
</html>